Mid
Heap / Quickselect
DSA & Coding Interviews
What is the Kth Largest Element approach in an interview?
Short answer: Min-heap of size k: O(n log k). Quickselect (partition) average O(n), worst O(n²). Sorting is O(n log n) — mention then improve.
Common follow-ups
- Kth largest in a stream
- Find median
If they care about worst-case, discuss heap; if average-case, mention Quickselect.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png