Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Insertion sort
#python 3.6.9 def InsertionSort(arr): for i in range(1, len(arr)): 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, 13, 5, 6] InsertionSort(arr) print ("Sorted array is:") for i in range(len(arr)): print ("%d" %arr[i])
run
|
edit
|
history
|
help
0
Asdf
Grupo1
PyRef
kenken1
sainik
PyEnum
emoji
hw1
Lesson6 part b
PyGuessTheNum2