How to determine whether a binary tree is complete?

前端 未结 16 1367
渐次进展
渐次进展 2021-01-02 19:15

A complete binary tree is defined as a binary tree in which every level, except possibly the deepest, is completely filled. At deepest level, all nodes must be as far left a

16条回答
  •  执笔经年
    2021-01-02 20:02

    You could combine three pieces of information from the subtrees:

    • Whether the subtree is complete

    • The maximal height

    • The minimal height (equal to maximal height or to maximal height - 1)

提交回复
热议问题