You are viewing a single comment's thread. Return to all comments →
def insertionSort2(n, arr): # Write your code here for i in range(1, n): j = i while j > 0 and arr[j-1] > arr[j]: arr[j-1], arr[j] = arr[j], arr[j-1] j = j - 1 else: print(*arr, sep=" ") return arr
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 →