Exercise: Insertion Sort

Run Settings
LanguagePython
Language Version
Run Command
def insertionSort(array): n = len(array) i = 1 while i < n: j = i while j > 0 and array[j-1] > array[j]: array[j], array[j-1] = array[j-1], array[j] j -= 1 i += 1 return array numbers = [99, 44, 6, 2, 1, 5, 63, 87, 283, 4, 0] answer = insertionSort(numbers) print(answer)
Editor Settings
Theme
Key bindings
Full width
Lines