Talk:Sorting algorithms/Quicksort: Difference between revisions

 
Line 88:
 
: The comments say just it's a good pivot choice for already sorted data or for reverse sorted data; I haven't checked it, but I can believe it, as I can believe it's not a so good choice for "symmetric triangle" distribution. --[[User:ShinTakezou|ShinTakezou]] 18:44, 26 June 2009 (UTC)
 
--[[User:Mecej4|Mecej4]] ([[User talk:Mecej4|talk]]) 01:06, 1 October 2022 (UTC)
The routine Qsort may get stuck in an infinite loop when the input array has two or more elements of equal value. For example:
 
L=4
A(1)%value = 2.0; A(2)%value = 1.0; A(3)%value = 3.0; A(4)%value=2.0
A(1)%order = 1; A(2)%order = 2; A(3)%order = 3; A(4)%order = 4
call Qsort(A, L)
 
== IDL ==
29

edits