Insertion Sort 1 Comments


  • 1 3 3
    1 2 3
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
    at Main.insertSort(
    at Main.doStuff(

  • import java.util.*;
    class Main{
    static void doStuff(int[] ar){
    //your code here
    int n=ar[ar.length-1];

    static void insertSort(int[] ar,int n){
  • Dear Admin,

    As what i can see from the "Your Output" it is the same as "Correct Output", however the last array is not displayed so im not sure if im getting "Incorrect" due to the last array or something else.

  • @David, it displays all the output. Make sure you're printing the final steps too.

  • Thanks Admin, i noticed just now... double checking on my end needs to be improved.

Contact Us
Sign in or email us at [email protected]