this code doesn’t work. im not sure why.it doesn’t show any error messange. I put the code and output message
def insertionSort(arr):
n = len(arr)
if n <= 1 :
return
for i in range(1, n):
key = arr[i]
j = i-1
while j >= 0 and key < arr[j]:
arr [j+1] = arr[j]
j = 1
arr [j+1] = key
arr = [12, 11, 14, 34, 23, 52]
insertionSort(arr)
print (arr)
this is output
C:UsersacerAppDataLocalProgramsPythonPython39python.exe D:PyCharmProjectproject1.py
Process finished with exit code 0
I expect this code to sort the list [12, 11, 14, 34, 23, 52] in ascending order
1