MCPcopy Create free account
hub / github.com/geekcomputers/Python / Insertion_Sort

Function Insertion_Sort

Sorting Algorithms/Binary_Insertion_Sort.py:14–20  ·  view source on GitHub ↗
(Test_arr)

Source from the content-addressed store, hash-verified

12
13
14def Insertion_Sort(Test_arr):
15 for i in range(1, len(Test_arr)):
16 val = Test_arr[i]
17 j = Binary_Search(Test_arr[:i], 0, len(Test_arr[:i]) - 1, val)
18 Test_arr.pop(i)
19 Test_arr.insert(j, val)
20 return Test_arr
21
22
23if __name__ == "__main__":

Callers 1

Calls 3

Binary_SearchFunction · 0.85
popMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected