codeflash/code_to_optimize/bubble_sort.py

11 lines
308 B
Python
Raw Normal View History

def sorter(arr):
2025-03-19 22:59:13 +00:00
print("codeflash stdout: Sorting list")
2025-03-12 00:35:34 +00:00
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
2025-03-19 22:59:13 +00:00
print(f"result: {arr}")
2025-03-11 21:37:44 +00:00
return arr