Skip to content

Commit 91920e1

Browse files
authored
Merge pull request #1 from Pavan-ops/Pavan-ops-patch-1
Create Bubblesort
2 parents 99cf7d7 + ae63a27 commit 91920e1

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Bubblesort

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def BubSort(lis):
2+
n = len(lis)
3+
for i in range(0,n):
4+
for j in range(0, n-i-1):
5+
if lis[j] > lis[j+1] :
6+
lis[j], lis[j+1] = lis[j+1], lis[j]
7+
8+
n=input("Enter the number of values")
9+
lis=[]
10+
for i in range(n):
11+
lis.append(input("Enter the value"))
12+
13+
BubSort(lis)
14+
print ("Sorted array :")
15+
for i in range(len(lis)):
16+
print ("%d" %lis[i])

0 commit comments

Comments
 (0)