Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lehuuphuocct123 committed Nov 1, 2023
1 parent 4414d9a commit 530ae3c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tasks/python/medium/bubble_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

def bubble_sort(arr):
# TODO: Implement the bubble sort algorithm
for i in range(0, len(arr)):
for j in range(i+1, len(arr)):
if arr[i] >= arr[j]:
temp = arr[i]
arr[i] = arr[j]
arr[j] = temp

return arr

#! Test cases (Don't edit):
arr = [64, 25, 12, 22, 11]
Expand Down

0 comments on commit 530ae3c

Please sign in to comment.