this is a google interview question :
Given a N*N Matrix. All rows are sorted, and all columns are sorted. Find the Kth Largest element of the matrix.
doing
You can find the kth smallest element in time O(n log n) expected, if you notice that:
Using [1] as a subroutine, you can use a procedure similar to RANDOMIZED-SELECT to generate the kth smallest number in the whole array.