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

Function insertionSort

Sorting Algorithms/Tim_sort.py:15–23  ·  view source on GitHub ↗
(arr, left, right)

Source from the content-addressed store, hash-verified

13# This function sorts array from left index to
14# to right index which is of size atmost RUN
15def insertionSort(arr, left, right):
16 for i in range(left + 1, right + 1):
17 temp = arr[i]
18 j = i - 1
19 while j >= left and arr[j] > temp:
20 arr[j + 1] = arr[j]
21 j -= 1
22
23 arr[j + 1] = temp
24
25
26# merge function merges the sorted runs

Callers 1

timSortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected