Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
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
Please
log in
to post a comment.
GINGERMANZ
Lesson#6
find x with f(x) = 0 (limited area of solution)
shuru1
global 3
Dictionary - count characters
super and overriding
Lesson 6 part 3
Generating subsets
Prime_list
Please log in to post a comment.