diff --git a/python/insertion_sort.py b/python/insertion_sort.py new file mode 100644 index 0000000..483ed88 --- /dev/null +++ b/python/insertion_sort.py @@ -0,0 +1,8 @@ +def insertionsort(liste): + for j in range(1,len(liste)): + key = liste[j] + i = j - 1 + while i >= 0 and key < liste[i]: + liste[i+1] = liste[i] + i -= 1 + liste[i+1] = key