This is correct. It ensures there can be no degenerate partitions and improves the worse case run time to be asymptotically equal to the average case.
In practice you would want to use a simple pivot selection algorithm and only resort to SELECT when the simple algorithm fails to produce a partition within a fixed fraction of 50/50. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.