diff --git a/slides/cours_7.md b/slides/cours_7.md index 970d5da056bc10da4f8c69d6c2c9df87c28ad43c..5d9e4ea2b5292e9297df2edb4859829e64e7dd3f 100644 --- a/slides/cours_7.md +++ b/slides/cours_7.md @@ -1,6 +1,6 @@ --- title: "Tris et backtracking" -date: "2021-11-12" +date: "2021-11-10" patat: eval: tai: @@ -140,7 +140,7 @@ int low, high; // les indices min/max des tableaux à trier ```C void quicksort(array, low, high) { - if (less than 2 elems) { + if (more than 2 elems) { pivot_ind = partition(array, low, high); if (something left of pivot) quicksort(array, low, pivot_ind - 1); @@ -157,8 +157,8 @@ void quicksort(array, low, high) { ```C int partition(array, low, high) { pivot = array[high]; // choix arbitraire - i = first - 1; - j = last; + i = low; + j = high-1; while i < j { en remontant i trouver le premier élément > pivot; en descendant j trouver le premier élément < pivot;