Skip to content

Commit d50d4fb

Browse files
committed
Added bubble sort solution by Yash
1 parent ae68a78 commit d50d4fb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

241080078_file.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Bubble Sort by Yash
2+
def bubble_sort(arr):
3+
n = len(arr)
4+
for i in range(n - 1):
5+
for j in range(n - i - 1):
6+
if arr[j] > arr[j + 1]:
7+
arr[j], arr[j + 1] = arr[j + 1], arr[j]
8+
return arr
9+
10+
print("Sorted:", bubble_sort([5, 2, 1, 4, 3]))

0 commit comments

Comments
 (0)