Select Git revision
dfs-arbre.py
-
Romain Vuillemot authoredRomain Vuillemot authored
tri-bulle.py 358 B
def tri_bulle_iteratif(lst):
""" Tri par bulle """
taille = len(lst)
for i in range(taille-1) :
for j in range(i+1, taille) :
if lst[i] > lst[j] :
lst[i] , lst[j] = lst[j] , lst[i] # permutaion
return lst
liste=[1,3,13,4,7,2,9,2,18]
print(tri_bulle_iteratif(liste))
# [1, 2, 2, 3, 4, 7, 9, 13, 18]