在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也可以向下浮动.那么为什么不把这视为最坏的情况呢?