20
loading...
This website collects cookies to deliver better user experience
BalanceFactor = height(left sub-tree) - height(right sub-tree)
should be -1, 0 or 1.15 (bf:2)
/
11 (bf:1) left unbalanced tree
/
9 (bf:0)
11 (bf:0)
/ \
(bf:0) 9 15 (bf:-0)
15 (bf:-2)
\
17 (bf:-1) right unbalanced tree
\
19 (bf:0)
17 (bf:0)
/ \
(bf:0) 15 19 (bf:0)
15 (bf:-2)
\
19 (bf:1)
/
16 (bf:0)
15 (bf:-2)
\
16 (bf:-1)
\
19 (bf:0)
16 (bf:0)
/ \
(bf:0)15 19 (bf:0)
15 (bf:2)
/
11 (bf:-1)
\
13 (bf:0)
15 (bf:2)
/
13 (bf:1)
/
11 (bf:0)
13 (bf:0)
/ \
(bf:0) 11 15 (bf:0)