You are viewing a single comment's thread. Return to all comments →
public static void insertionSortPart2(int[] array) { for (int i = 1; i < array.length; i++) { int j = i; int value = array[i]; while (j >= 1 && array[j-1] > value) { array[j] = array[j-1]; j--; } array[j] = value; printArray(array); } }
Full solution available in my HackerRank solutions.
Let me know if you have any questions.
Seems like cookies are disabled on this browser, please enable them to open this website
Insertion Sort - Part 2
You are viewing a single comment's thread. Return to all comments →
Java solution - passes 100% of test cases
Full solution available in my HackerRank solutions.
Let me know if you have any questions.