相关疑难解决方法(0)

MAX-HEAPIFY的最坏情况:"最坏的情况发生在树的底层正好是半满的时候"

CLRS,第三版,第155页,给出了在MAX-HEAPIFY中,

"the worst case occurs when the bottom level of the tree is exactly half full"  
Run Code Online (Sandbox Code Playgroud)

我想原因是在这种情况下,Max-Heapify必须通过左子树"向下浮动".
但我无法得到的是"为什么半满"?
如果左子树只有一个叶子,Max-Heapify也可以向下浮动.那么为什么不把这视为最坏的情况呢?

algorithm heap clrs

15
推荐指数
2
解决办法
6917
查看次数

标签 统计

algorithm ×1

clrs ×1

heap ×1