## Re:Index Search + Quick Sort

In article <379971d...@news1.mweb.co.za>, patrick <bdinn...@mweb.co.za>

writes

##### Quote

>can someone please help...

>please just explain the theory behind quick sort, i will

>figure out the code on my own (if i can) i just need to know what exactly

>these methods entail.

Patrick - imagine you have a huge pile of stones. Pick a medium-sized

stone for reference purposes and then create two piles of stones, the

stones in the left pile being smaller than or equal to the reference

stone and the stones in the right pile being larger than the reference

stone.

Repeat the above operation on the left pile of stones and then on the

right pile of stones. Got four piles now? Good.

Repeat the operation on each of the four piles of stones... continue

until the piles are down to one stone each (some piles will get there

first).

Is this starting to make sense? Note that it's an obvious candidate for

a recursive solution!

That's how Quicksort works "logically". The "physical" details of

getting it to work in array-space are a little more subtle. Study any

standard text-book Quicksort algorithm to see how to handle this (but

keep the "piles of stones" analogy in mind - it helped me).

--

Marcus Morris

Ledbury, Herefordshire

Mar...@ntos.demon.co.uk