public static void Main()
int[] notSorted = { 3, 8, 4, 1, 9, 6, 2, 5, 7, 1 };
Console.WriteLine("Insertion:");
PrintArray(InsertionSort(notSorted.Select(i => i).ToArray()));
public static int[] InsertionSort(int[] array)
for(int i = 1; i < array.Length; i++){
for(j = i - 1; j >= 0; j--)
public static void swap(int[] array, int first, int second){
array[first] = array[second];
public static void PrintArray(int[] array) {
foreach (int element in array) {
Console.Write(element + "; ");