我在一个问题上停留了一段时间,想知道是否有人可以指出正确的方向:
Suppose binary heaps are represented using a pointer-based tree representation instead of an array. Consider the problem of merging binary heap LHS with RHS. Assume both heaps are full complete trees, containing (2^L - 1) and (2^R -1) nodes, respectively.
Give two O(log N) algorithms to merge the two heaps, one if L = R and one if |L - R| = 1.
这是一道作业题,我只需要指出正确的方向即可。
最佳答案
L=R 的提示:假装你刚刚删除了根。如果您需要更多,请告诉我。
关于java - 合并两个完美的二进制堆?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2114637/