How to define a balanced or perfectly balanced binary search tree (only from the picture)

I'm not sure how to determine if a tree is balanced, perfectly balanced or not, if I have this as an image, not a code

For example, if I have this tree. How can I check if it is balanced, perfectly balanced or unbalanced? and can anyone give me an example of a perfectly balanced tree?

    [o]
   /   \
 [b]   [p]
   \    / \
  [d]  [m] [r]

Clearly, I can say that the tree is unbalanced if it was something like this:

      [b]
        \
        [d]
         \
          [r]
           \
           [c]

However, if it was something very similar to the one above, I don’t know how to get it

This is a balanced and balanced tree:

        [k]
       /   \
      [A]   [p]
            /  \
           [N]  [R]

Can someone explain this to me?

+4
3

:

       [ R ]
      /     \
    [a]      [b]
   /   \     /  \
 [c]   [d] [e]  [f]

. , , node 1 ( 0),

. , , 2 ^ (n + 1) -1, n - , (2 ^ 3) - 1 = 7

1- , , . , node 1 , , 5, 7 .

EDIT:

, , , , . , "" , node, , 2 , . , node, . node A 0, 0 → 0 - 0 = 0, P 1 → 1 - 1 = 0, - 1, 2 → 2 - 1 = 1 < - , 1 .

, !

+7

AVL 1

+1

() , (BST), , . - https://en.wikipedia.org/wiki/Binary_tree, , - , CS . , , :

A BT , , node ; , () node 2 ; , ; , , , , ( "" " "; , node ( - ).

: , , - node [b] , ; (); ( node, ) 1-- , (= ?). "" "( " 0 "), , .

, [b] , [p] , ( , ) - .

( ). ( , , "", "1- " "" "".)

- , ( ), k-, , node k, node k. , AVL 1 .

"" , " BT", , , node , , - .

0
source

All Articles