Skip to content

Commit fa90fae

Browse files
authored
Update bubble_sort.py
1 parent e268bf1 commit fa90fae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sorts/bubble_sort.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
python bubble_sort.py
1111
"""
1212

13-
from __future__ import print_function
13+
from __future__ import print_function #__future__ is the use in Python2.7
1414

1515

1616
def bubble_sort(collection):
@@ -31,7 +31,7 @@ def bubble_sort(collection):
3131
[-45, -5, -2]
3232
"""
3333
length = len(collection)
34-
for i in range(length-1, -1, -1):#range(length-1, -1, -1)
34+
for i in range(length-1, -1, -1):#range(length-1, -1, -1) # why is the turn reversed? direction of bubbles movement?
3535
for j in range(i):#range(1, i)
3636
if collection[j] > collection[j+1]:
3737
collection[j], collection[j+1] = collection[j+1], collection[j]

0 commit comments

Comments
 (0)