Skip to content

Commit bfddd40

Browse files
committed
bubble sort
1 parent e5f8d72 commit bfddd40

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Day8/q33.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Implementation of bubble sort
2+
def bubble_Sort(l):
3+
n = len(l)
4+
for i in range(n):
5+
for j in range(0, n-i-1):
6+
if l[j] > l[j+1]:
7+
l[j], l[j+1] = l[j+1], l[j]
8+
9+
10+
arr = [64, 34, 25, 12, 22, 11, 90]
11+
12+
bubble_Sort(arr)
13+
for i in range(len(arr)):
14+
print(arr[i])

0 commit comments

Comments
 (0)