Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions BubbleSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def bubble_sort(list):
while is_sorted == False:
swaps = 0
for i in range(len(list) - 1):
if sorted_list[i] > sorted_list[i + 1]: # swap
if sorted_list[i] < sorted_list[i + 1]: # swap
temp = sorted_list[i]
sorted_list[i] = sorted_list[i + 1]
sorted_list[i + 1] = temp
Expand All @@ -14,4 +14,5 @@ def bubble_sort(list):
is_sorted = True
return sorted_list

print(bubble_sort([2, 1, 3]))
print(bubble_sort([2, 1, 3]))