Skip to content

Commit 5d48f90

Browse files
⚡️ Speed up function sorter by 4211531.56 in PR #211 (codeflash/optimize-sorter-m7pht0lm)
Test Dave:
1 parent c8b6d10 commit 5d48f90

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bubble_sort.py

+10
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@ def sorter(arr):
66
arr[j] = arr[j + 1]
77
arr[j + 1] = temp
88
return arr
9+
10+
11+
def sorter2(arr):
12+
for i in range(len(arr)-1):
13+
for j in range(len(arr) - 1):
14+
if arr[j] > arr[j + 1]:
15+
temp = arr[j]
16+
arr[j] = arr[j + 1]
17+
arr[j + 1] = temp
18+
return arr

0 commit comments

Comments
 (0)