java - 合并两个完美的二进制堆?

标签 java data-structures merge binary-heap

我在一个问题上停留了一段时间,想知道是否有人可以指出正确的方向:

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/

相关文章:

c++ - 图中最大独立集的递归程序

c - 搜索不适用于哈希表

algorithm - 合并多个排序数组的分而治之策略

eclipse - Subclipse (SVN) 比较显示相似文件

c# - C# 和 Java 中 Triple DES 的实现有什么区别吗? Java 给出错误 IV 大小错误

java - 使用与封闭类具有相同泛型类型的静态嵌套类

java - 如何在 jprofiler 调用树中聚合方法时间

python - 如何以最快的方式从 Python 中的计数器中删除频率最低的元素?

git - 我如何在 git 中管理 merge 和 rebase ?

java - 可变高度 ListView