Sorting algorithms/Quicksort: Difference between revisions

Content added Content deleted
(Fixed mistake in the Ada implementaion)
Line 175: Line 175:
exit when Left >= Right;
exit when Left >= Right;
Swap(Item(Left), Item(Right));
Swap(Item(Left), Item(Right));
if Left < Item'Last and Right > Item'First then
if Pivot_Index = Left then
Left := Index_Type'Succ(Left);
Pivot_Index := Right;
Right := Index_Type'Pred(Right);
elsif Pivot_Index = Right then
Pivot_Index := Left;
end if;
end if;
end loop;
end loop;