Definition of a Balanced Tree

后端 未结 6 880
暖寄归人
暖寄归人 2020-12-04 05:38

I am just wondering if someone might be able to clarify the definition of a balanced tree for me. I have that \"a tree is balanced if each sub-tree is balanced and the heigh

6条回答
  •  -上瘾入骨i
    2020-12-04 06:28

    1. The height of a node in a tree is the length of the longest path from that node downward to a leaf, counting both the start and end vertices of the path.
    2. A node in a tree is height-balanced if the heights of its subtrees differ by no more than 1.
    3. A tree is height-balanced if all of its nodes are height-balanced.

提交回复
热议问题