Skip to content

Commit b0b538b

Browse files
committed
fix bug in bubble_sort to move made_swap between two loops
1 parent 122e1e7 commit b0b538b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/11_sorts/sorts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
def bubble_sort(a: List[int]):
1212
if len(a) <= 1: return
1313

14-
made_swap = False
1514
for i in range(len(a)):
15+
made_swap = False
1616
for j in range(len(a) - i - 1):
1717
if a[j] > a[j+1]:
1818
a[j], a[j+1] = a[j+1], a[j]

0 commit comments

Comments
 (0)