Recently I came across an interesting interview question. To find the kth largest or smallest element in the given array. Please remember that array is unsorted. The problem becomes cakewalk if array is sorted.
In its simplest form, if an array a of size n is already sorted, you can