I got stuck in the question for a while and wondered if anyone could point me in the right direction:
Suppose binary heaps are represented using a pointer tree instead of an array. Consider the problem of merging the LHS binary heap with RHS. Suppose that both heaps are complete full trees containing (2 ^ L - 1) and (2 ^ R -1) nodes, respectively. Give two O (log N) algorithms to combine two heaps, one if L = R and one if | L - R | = 1.
This is a domestic problem, I just need to point in the right direction.
java merge data-structures binary-heap
user220755
source share