Skip to content

Commit

Permalink
Merge 093ad48 into 30ca4ae
Browse files Browse the repository at this point in the history
  • Loading branch information
VARoDeK committed Oct 3, 2018
2 parents 30ca4ae + 093ad48 commit a59302f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions algorithms/sort/bubble_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ def swap(i, j):
iteration = 0
if simulation:
print("iteration",iteration,":",*arr)

x = -1
while swapped:
swapped = False
for i in range(1, n):
x = x + 1
for i in range(1, n-x):
if arr[i - 1] > arr[i]:
swap(i - 1, i)
swapped = True
Expand Down

0 comments on commit a59302f

Please sign in to comment.