1. Computing
in Delphi :: One of the common problems in programming is to sort an array of values in some order (ascending or descending). While there are many "standard" sorting algorithms, QuickSort is one of the fastest. Quicksort sorts by employing a divide and conquer strategy to divide a list into two sub-lists. Here's a Delphi implementation.

Read the full article to learn how to QuickSort in Delphi

Related:

Comments
October 2, 2007 at 4:18 pm
(1) Richard Winston says:

Note that TList.Sort uses QuickSort so there is usually no need to implement your own version of QuickSort.

October 3, 2007 at 3:34 am
(2) Zarko Gajic says:

Richard,

Yes TList uses QuickSort – but if you have a simply array of values you need to sort … this implementation is just what you need.

October 3, 2007 at 4:16 am
(3) Juandy says:

Btw, is there any other algorithm that performs as fast as quicksort ?

Can quicksort be implemented without using recursive?

October 3, 2007 at 5:03 am
(4) Zarko Gajic says:

In the heart of QuickSort is recursion – this is how QuickSort is defined. Therefore, no it cannot be done without using recursion. If it could, it would not be called “QuickSort”.

There are other algorithms that are more appropriate if more than 50% of the values in the array are the same – array already partialy sorted (for example, “HeapSort”).

April 28, 2010 at 10:25 am
(5) Teun van Immerzeel says:

Every recursive algorithme can be coded non-recursive by using an explicite stack. Some languages require it. I did it in the 80thies in Fortran.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.