Question 51
What is the worst-case time complexity of inserting an element into a binary heap of n elements?
The new element may move from a leaf to the root.
What is the worst-case time complexity of inserting an element into a binary heap of n elements?
The new element may move from a leaf to the root.
What is the worst-case time complexity of extracting the root from a binary heap of n elements?
After replacing the root, heapify-down follows a root-to-leaf path.
What is the time complexity of finding an arbitrary element in a binary heap in the worst case?
A heap only constrains parent-child order and does not support arbitrary-key search in logarithmic time.
What is the time complexity of building a heap using bottom-up heap construction?
The total work over all heapify operations is linear.
In a max-heap, after inserting a new key, which operation restores heap order?
The new leaf is compared with its parent and moved upward as needed.