(customList)
| 26 | # INSERTION SORT |
| 27 | |
| 28 | def 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)) |