Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
HW. InsertionSort in Descending order
#python 3.5.2 print ("Hello, world!") def InsertionSort(alist): length = len(alist) for position in range(1, length): # 1, 2, 3 currentValue = alist[position] # = {17} while position > 0 and alist[position-1] < currentValue: alist[position] = alist[position-1] position = position - 1 # 3->2 alist[position] = currentValue print ('Updating: ', alist) return alist alist = [1, 5, 89, 8, 23, 1] print (InsertionSort(alist))
run
|
edit
|
history
|
help
0
quiz1
snake water gam correct
Ej2_PYTHON_203700377.
one
Print 5
inerse_matrix_gauss_jordan
9th jan
jsa
PyStack
Game2