MCPcopy Create free account
hub / github.com/BeeBombshell/Python-DSA / insertion_sort

Function insertion_sort

Sorting Algorithms/insertion_sort.py:1–10  ·  view source on GitHub ↗
(array)

Source from the content-addressed store, hash-verified

1def insertion_sort(array):
2 for i in range(1, len(array)):
3 temp = array[i]
4 j = i-1
5
6 while j >= 0 and temp < array[j]:
7 array[j+1] = array[j]
8 j = j-1
9
10 array[j+1] = temp
11

Callers 1

bucketsortMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected