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:**

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

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.

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

Can quicksort be implemented without using recursive?

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”).

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.