Skip to content

Commit 1d8b1ed

Browse files
committed
wip
1 parent 0fa6c75 commit 1d8b1ed

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

codeflash/bubble_sort.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
def mysorter(arr):
22
print("codeflash stdout: Sorting list")
3-
arr.sort() # built-in Timsort, much faster than bubble sort
3+
for i in range(len(arr)):
4+
for j in range(len(arr) - 1):
5+
if arr[j] > arr[j + 1]:
6+
temp = arr[j]
7+
arr[j] = arr[j + 1]
8+
arr[j + 1] = temp
49
print(f"result: {arr}")
510
return arr
6-
7-
8-
mysorter([5, 4, 3, 2, 1])
11+
mysorter([5,4,3,2,1])

0 commit comments

Comments
 (0)