does anybody know how to make bubble sort work in progressively smaller sizes and determine if a list is sorted on it's first try?
i've got the basic bubble sort algorithm down.
i just can't figure out the rest of it
(my basic bubble sort code below)
def bubbleSort(list1): for j in range(len(list1)-1): for k in range(len(list1)-1-j): if list1[k] > list1[k+1]: swap = list1[k] list1[k] = list1[k+1] list1[k+1] = swap