Skip to content

Commit 1fc1f73

Browse files
OvandoOvando
authored andcommitted
added bubble sort
1 parent 5ec8dfa commit 1fc1f73

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Python

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 73f6d8efff7753d6bdd7cd634ccf4b98490f57fb

bub.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
def sw(a,b):
2+
a, b = b, a
3+
return [a,b]
4+
5+
6+
def bub(list):
7+
for a, a_val in enumerate(list):
8+
for b, b_val in enumerate(list):
9+
if a_val < b_val:
10+
list[a],list[b]=list[b],list[a]
11+
print list
12+
return list
13+
14+
15+
16+
print bub([1,5,3,2,4])

0 commit comments

Comments
 (0)