Sorting algorithms/Quicksort: Difference between revisions

Content added Content deleted
(Ada - It fails with two elements arrays)
Line 52: Line 52:
begin
begin
if Item'Length > 2 then
if Item'Length > 1 then
Pivot_Index := Index_Type'Val((Index_Type'Pos(Item'Last) + 1 +
Pivot_Index := Index_Type'Val((Index_Type'Pos(Item'Last) + 1 +
Index_Type'Pos(Item'First)) / 2);
Index_Type'Pos(Item'First)) / 2);