Adding items to a heap and removing them are operations that both have time

complexity O(log n). Why?

a. The number of comparisons is at most the number of nodes in the lowest level of

the tree, which is the base 2 logarithm of n, where n is the number of nodes in a

full tree of that height.

b. Adding new nodes to a heap follows a logarithmic sequence.

c. The number of swaps is at most the height (# of levels) of the tree and the height

is always close to the base 2 logarithm of n, where n is the number of nodes in

the tree.

d. The value of the root in a heap will always be at most the base 2 logarithm of the

value of any other node.