Maintain a min-heap of size :
Insert the first elements into the heap.
For each remaining element: - If it's larger than the heap root, extract root and insert element. - Otherwise, skip it.
Return the heap root. The heap always contains the largest elements seen so far. Its root (minimum of these ) is the k-th largest overall. Time: . Space: .