MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / insertion_sort

Function insertion_sort

sorts/timsort.py:20–28  ·  view source on GitHub ↗
(lst)

Source from the content-addressed store, hash-verified

18
19
20def insertion_sort(lst):
21 length = len(lst)
22
23 for index in range(1, length):
24 value = lst[index]
25 pos = binary_search(lst, value, 0, index - 1)
26 lst = lst[:pos] + [value] + lst[pos:index] + lst[index+1:]
27
28 return lst
29
30
31def merge(left, right):

Callers 1

timsortFunction · 0.70

Calls 1

binary_searchFunction · 0.70

Tested by

no test coverage detected