Heaps & Priority Queues

Answer & solution
Official answer: B
A binary heap has heightΘ(log n). Extract-Max removes the root, moves the final element there, and can sift it down the full height. Insertion appends a leaf and can sift it up the full height. Both therefore take O(log n) worst-case time, option B, under the ordinary heap-storage model without charging an occasional external dynamic-array resize.
Teaching detail. Reading a heap's maximum is O(1) because it is at the root, but Extract-Max includes deletion and restoration, which is more work. A replacement root may be smaller than descendants all the way to a leaf, requiring one comparison/swap step per level. A newly inserted large key may similarly rise from its leaf to the root. A complete binary tree has logarithmic height, giving both upper bounds, and such examples attain that height. Neither operation scans all n items in the ordinary representation.