Tutorial 7 - Sorting

Q3b

It is possible to make quicksort `O(n \lg n)` in the worst case by finding the median in linear time and using it to partition the array, this way the partition set always splits the array into equal halves. However the algorithm for finding the median in linear time is not easy to implement and it is not practical for reasonable datasets.

It is also possible to make mergesort in-place using an in-place merging algorithm. Can you think of how to do it?

Three Beautiful Quicksort

Quicksort is probably the most widely used sorting algorithm. Jon Bentley gave a talk on “Three Beautiful Quicksorts” at Google. Highly recommended!

 
cs1102/tut7.txt · Last modified: 2009/04/02 16:34 by melvin
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki