You are viewing a single comment's thread. Return to all comments →
My code in JAVA
public static void insertionSort1(int n, List arr) {
int last = arr.get(n-1); int i ; for(i = n-2; i>= 0 && arr.get(i) >last; i--){ arr.set(i+1, arr.get(i)); PrintArray(arr); } arr.set(i+1, last); PrintArray(arr); } public static void PrintArray(List<Integer> arr){ for (int num : arr) { System.out.print(num+" "); } System.out.println(); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Insertion Sort - Part 1
You are viewing a single comment's thread. Return to all comments →
My code in JAVA
public static void insertionSort1(int n, List arr) {
}