Are you sure in this? Once you have found a number so that exactly half of the numbers are to the left and half are to the right, couldn't you separate these two classes of numbers, sort them separately, and still get an O(N log N) time sort this way?Well, yes, that is the point. However, to archieve this, you 1) must divide the set into pieces in linear time and 2) each subset must contain at least cN numbers, for some 0 < c < 1. Using the median as the pivot to divide the set satisfies condition 2), but to satisfy condition 1), you need to find the median in linear time.
In reply to Re^4: Puzzle: The Ham Cheese Sandwich cut.
by Perl Mouse
in thread Puzzle: The Ham Cheese Sandwich cut.
by Perl Mouse
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |