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
Homework exercise
Merge sort implementation
Minesweeper
31 dec string
Python3
Christmas tree
Va
shuru16
Python3: Class I : Person (ClassMethod)
shuru1