You are viewing a single comment's thread. Return to all comments →
C# Solution
public static void insertionSort1(int n, List<int> arr) { var last = arr[n - 1]; for (int i = n - 1; i >= 0; i--) { if (i == 0 || last > arr[i - 1]) { arr[i] = last; Console.WriteLine(string.Join(" ", arr)); break; } else { arr[i] = arr[i - 1]; Console.WriteLine(string.Join(" ", arr)); } } }
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 →
C# Solution