Motivation [00QA]
Consider the following problem: given a (not necessarily sorted!) array of n integers, find the median element (that is, the element which would be in the middle if the array were sorted).
One obvious solution is to first sort the array in \Theta (n \log n) time, and then simply access the array in the middle. However, intuitively it feels like this is doing too much work: we don’t actually care about the order of any of the other elements, so sorting them is a waste of time. Can we do better than \Theta (n \log n)?