Skip to content

Commit

Permalink
Update bubble_sort.py
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgirdwood1 authored Feb 14, 2025
1 parent 97f70aa commit 2f1a879
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions bubble_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,13 @@ def sorter(arr):
arr[j] = arr[j + 1]
arr[j + 1] = temp
return arr


def sorter2(arr):
for i in range(len(arr)):
for j in range(len(arr) - 1):
if arr[j] > arr[j + 1]:
temp = arr[j]
arr[j] = arr[j + 1]
arr[j + 1] = temp
return arr

0 comments on commit 2f1a879

Please sign in to comment.