Skip to content

Commit 00e53ae

Browse files
authored
Update bubble-sort.py
1 parent a0b19a5 commit 00e53ae

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

bubble-sort/python/bubble-sort.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def bsort(x):
2+
n=len(x)
3+
k=1
4+
while(True):
5+
c=0
6+
for i in range(0,n-k):
7+
if x[i]>x[i+1]:
8+
x[i],x[i+1]=x[i+1],x[i]
9+
c+=1
10+
if c==0 :
11+
break
12+
k+=1

0 commit comments

Comments
 (0)