You are viewing a single comment's thread. Return to all comments →
There's more than one way to do it,
def insertionSort2(n, arr): if n <= 1: return for i in range(1, n): j = i while j > 0 and arr[j-1] > arr[j]: arr[j], arr[j-1] = arr[j-1], arr[j] j -= 1 print(" ".join(map(str, 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 →
There's more than one way to do it,