|
|
@ -8,3 +8,12 @@ def tri_selection(liste): |
|
|
for j in range(i + 1, n): |
|
|
for j in range(i + 1, n): |
|
|
if liste[j] < liste[indice_min]: |
|
|
if liste[j] < liste[indice_min]: |
|
|
indice_min = j |
|
|
indice_min = j |
|
|
|
|
|
# On échange les éléments |
|
|
|
|
|
liste[i], liste[indice_min] = liste[indice_min], liste[i] |
|
|
|
|
|
|
|
|
|
|
|
return liste |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Exemple d'utilisation |
|
|
|
|
|
ma_liste = [64, 25, 12, 22, 11] |
|
|
|
|
|
print(tri_selection(ma_liste)) |