Selection and sorting with limited storage

When selecting from, or sorting, a file stored on a read-only tape and the internal storage is rather limited, several passes of the input tape may be required. We study the relation between the amount of internal storage available and the number of passes required to select the Kth highest of N inputs. We show, for example, that to find the median in two passes requires at least Ω(N1/2) and at most O(N1/2 log N) internal storage. For probabilistic methods, Θ(N1/2) internal storage is necessary and sufficient for a single pass method which finds the median with arbitrarily high probability.