MCPcopy Create free account
hub / github.com/Jack-Lee-Hiter/AlgorithmsByPython / gapInsertionSort

Function gapInsertionSort

ShellSort.py:10–18  ·  view source on GitHub ↗
(alist, start, gap)

Source from the content-addressed store, hash-verified

8 return alist
9
10def gapInsertionSort(alist, start, gap):
11 for i in range(start+gap, len(alist), gap):
12 currentValue = alist[i]
13 position = i
14
15 while position >= gap and alist[position-gap] > currentValue:
16 alist[position] = alist[position-gap]
17 position = position-gap
18 alist[position] = currentValue
19
20alist = [54,26,93,17,77,31,44,55,20]
21print(shellSort(alist))

Callers 1

shellSortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected