From 92481c5c640566f60108ff1806e8e31f08e86997 Mon Sep 17 00:00:00 2001 From: Clement Ballabriga <clement.ballabriga@univ-lille.fr> Date: Thu, 6 Oct 2022 11:57:27 +0200 Subject: [PATCH] fix quicksort error --- include/elm/data/quicksort.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/elm/data/quicksort.h b/include/elm/data/quicksort.h index cc2a1fbb..e3166e5c 100644 --- a/include/elm/data/quicksort.h +++ b/include/elm/data/quicksort.h @@ -38,8 +38,8 @@ void quicksort(A& array, const C& c = Comparator<typename A::t>()) { if(L < R) { piv = array[L]; while(L < R) { - while(c.doCompare(array[R], piv) >= 0 && L < R) R--; if(L < R) array[L++] = array[R]; - while(c.doCompare(array[L], piv) <= 0 && L<R) L++; if (L < R) array[R--] = array[L]; + while(c.compare(array[R], piv) >= 0 && L < R) R--; if(L < R) array[L++] = array[R]; + while(c.compare(array[L], piv) <= 0 && L<R) L++; if (L < R) array[R--] = array[L]; } array[L] = piv; beg[i+1] = L+1; end[i+1] = end[i]; end[i++] = L; if(end[i] - beg[i] > end[i-1] - beg[i-1]) { -- GitLab