我一直看到它被定义为
A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.
但是..我不知道“所有节点都尽可能远离”是什么意思。这就是我的问题。我无法进一步扩展它,因为我不知道“所有节点都尽可能远离”是什么意思。比如..与什么相比尽可能地靠左?我不明白
最佳答案
尽可能靠左的部分适用于 最后一级 .也就是说,在最后一层,您应该从左侧开始填充节点。
例如下面的 是一个有效的完全二叉树 因为在最后一层,所有节点都尽可能地靠左
以下不是
关于data-structures - 关于完全二叉树的困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22032590/