# Question: Suppose that you have a black box worst case

Suppose that you have a "black-box" worst-case linear-time median subroutine. Give a simple, linear-time algorithm that solves the selection problem for an arbitrary order statistic.

## Answer to relevant Questions

Let X [1 .. n] and Y [1 .. n] be two arrays, each containing n numbers already in sorted order. Give an O (lg n)-time algorithm to find the median of all 2n elements in arrays X and Y.Consider a version of the division method in which h (k) = k mod m, where m = 2p – 1 and k is a character string interpreted in radix 2p. Show that if string x can be derived from string y by permuting its characters, then ...Suppose that we "absorb" every red node in a red-black tree into its black parent, so that the children of the red node become children of the black parent. (Ignore what happens to the keys.) What are the possible degrees of ...Observe that whenever the size field of a node is referenced in either OS-SELECT or OSRANK, it is used only to compute the rank of the node in the sub tree rooted at that node. Accordingly, suppose we store in each node its ...Show how to compute the length of an LCS using only 2 · min (m, n) entries in the c table plus O (1) additional space. Then show how to do this using min (m, n) entries plus O (1) additional space.Post your question