void InsertionSort(int arr[]) { for(int i=1; i < arr.len(); i++) { int key = arr[i]; int j = i; while(key < arr[j-1] && j > 0) { //move key to previous position arr[j] = arr[j-1]; j--; } arr[j] = key; PrintArray(arr); } }