Is this tree a balanced binary tree?


  • 2
    S

    I had a question about what is a balanced binary tree. Is the following tree a balanced binary tree?

            1
          /  \
         2    3
        /    /  \
       4    5    6
                  \
                   7
    

    By the definition given in the problem, the depth of the two subtrees of every node never differ by more than 1 in the above tree, so it should be a balanced binary tree. But the tree doesn't look balanced.


  • 0
    M

    Same question here. IMO the definition of a balanced binary tree is that the min and max of the distances from root to leaf never differ than 2..


  • 0
    S
    This post is deleted!

  • 1
    S

    its actually balanced.

    children of 1 have 2 and 3 depth (balanced)
    children of 2 have 1 and 0
    children of 3 have 1 and 2
    children of 6 have 0 and 1
    

    hope it helps


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.