Multiple choice

The operation decrease-key(H,x,k) is an operation that decreases the key of node x by k (if k<key(x) ) in a binary heap. What is the maximum effort required for this operation?

  1. Equal to height of the tree

  2. Constant

  3. Number of nodes in the heap

  4. None of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In a binary heap, decreasing a key may require 'bubbling up' the node to maintain the heap property. This process takes time proportional to the height of the tree, which is O(log n).