Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Insertion sort
#python 3.5.2 def insertion():# main algorithm of insertion sort for j in range(1,len(A)): temp=A[j] i=j-1 while temp<A[i] and i>-1: A[i+1]=A[i] i-=1 A[i+1]=temp def printarray(): # to print status of array for k in range(len(A)): print(A[k],end=' ') print('\n') #A = input array A=[-80,60,40,0,11,-78,-190,-1464264364142,12462361241] printarray()# status of array before sorting insertion()#calling insertion function printarray()# status of array after sorting
run
|
edit
|
history
|
help
0
Lesson 5 part b
ct
prime_nonprime_count.py
one
Lesson 9 hw
if else
Hello
Return nth fibonacci number using memoization
PyStack
Lesson 6 part b2