You are viewing a single comment's thread. Return to all comments →
Here's my Python solution.
def insertionSort1(n, arr): insert = arr[-1] index = list(reversed([i for i in range(len(arr) - 1)])) for i in index: if insert <= arr[i]: arr[i + 1] = arr[i] print(" ".join([str(i) for i in arr])) else: arr[i + 1] = insert print(" ".join([str(i) for i in arr])) return arr[0] = insert print(" ".join([str(i) for i in 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 →
Here's my Python solution.