Binary Tree Height

后端 未结 8 2028
迷失自我
迷失自我 2020-12-29 12:34

I need a general formula to calculate the minimum height of the binary tree and the maximum height of the binary tree. (not the binary search tree)

8条回答
  •  囚心锁ツ
    2020-12-29 13:35

    Think about how the structure of the tree can change.

    For example, if the tree is completely unbalanced then this is the worst case - each node will have exactly one child. In the best case, the tree is completed balanced, and each node has two children.

    Since it sounds like homework, I'll leave it there.

提交回复
热议问题