Find the kth largest element using a max heap with O(n + k log n) time complexity
Floyd's heapify is O(n), not O(n log n), because most nodes are near leaves with small subtrees. The sum Σ h(i) over all nodes (where h(i) is height) equals n - ⌊log n⌋ - 1, not n log n. Each extraction removes the root and restores heap property in O(log n).
For k << n, heap selection beats sorting. QuickSelect offers O(n) expected time but O(n²) worst-case without median-of-medians.
A binary heap is stored as a complete binary tree in an array: parent at index i has children at 2i+1 and 2i+2. This implicit structure requires no pointer overhead. If modifying the input is allowed, heapify is in-place with O(1) auxiliary space.
Alternative: use a min-heap of size k to find kth largest in O(n log k) time and O(k) space—better when k << n.