Skip to content
Closed
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
11 changes: 4 additions & 7 deletions codeflash/bubble_sort.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
def mysorter(arr):
print("codeflash stdout: Sorting list")
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
arr.sort() # use built-in sort which is highly optimized
print(f"result: {arr}")
return arr
mysorter([5,4,3,2,1])


mysorter([5, 4, 3, 2, 1])
Loading