diff --git a/sorts/bubble_sort.py b/sorts/bubble_sort.py index b7f1b3c05..e1bdf3189 100644 --- a/sorts/bubble_sort.py +++ b/sorts/bubble_sort.py @@ -31,8 +31,8 @@ def bubble_sort(collection): [-45, -5, -2] """ length = len(collection) - for i in range(length-1, -1, -1):#range(length-1, -1, -1) - for j in range(i):#range(1, i) + for i in range(length): + for j in range(length-1): if collection[j] > collection[j+1]: collection[j], collection[j+1] = collection[j+1], collection[j]