MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / insertionSort

Function insertionSort

Python/all sorting methods.py:28–36  ·  view source on GitHub ↗
(customList)

Source from the content-addressed store, hash-verified

26# INSERTION SORT
27
28def insertionSort(customList):
29 for i in range(1,len(customList)):
30 key=customList[i]
31 j=i-1
32 while j>=0 and key < customList[j]:
33 customList[j+1] = customList[j]
34 j -= 1
35 customList[j+1] = key
36 return customList
37
38# cList=[2,1,3,6,9,7,4,8,5]
39# print(insertionSort(cList))

Callers 1

bucketSortFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected