Kth Largest Element
Topic: 10. Heaps
Link: LeetCode 215 - Kth Largest Element in an Array
1. Logical Breakdown
- [x] Core Logic: Min-Heap of size K.
- [x] Result: The root of the heap is the Kth largest.
2. Visualization
graph TD
Add["Add to Min-Heap"] --> Check["Size > K?"]
Check -- Yes --> Pop["Pop Smallest"]
Check -- No --> Continue
3. Complexity
- Time: O(N log K)
- Space: O(K)