Originally Posted by
openuser
I came across a simple way of quicksorting linked list which is same as iterative version of quicksort for arrays...
http://www.openasthra.com/c-tidbits/...ple-algorithm/
worth a look...
Let me know if you have any other simple algorithm for QuickSort (for sorting linked lists), should be easy to understand...
Thanks.
I had a look at that link and I'm afraid to tell you that it is of very poor quality. The spelling is horrible, and in fact it does NOT really implement list-based-quicksort.
What it actually does is implement array-based-quicksort, and treats a linked-list as an array. This leads to extremely poor performance. In fact I think that the implementation on that site is about O(n^3) or N-cubed. Not to mention it is far longer than it should be for this algorithm.
Perhaps you would consider taking a look at a page from my own personal site which I am currently putting together, instead: <URL snipped>
My explanations are currently a bit too brief, I'm constantly working on it and uploading a new copy every few days. Feel free to ask me questions about it.
Also, if you don't necessarily have to use quicksort, then you may consider looking around at some of the alternatives on that page. Again, please feel free to ask for me to provide more explanations where they would help.
Last edited by Ancient Dragon : May 21st, 2007 at 8:00 am. Reason: snipped URL