Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Left balanced binary trees

I am reading a book on data structures and it says that a left balanced binary tree is a tree in which the leaves only occupy the leftmost positions in the last level.

This seemed a little vague to me. Does this mean that leaves are only on the left side of a root and are distributed throughout the whole level, or leave exists only on the left side of the entire tree. Exactly what constitute left balanced?

I am not sure if my guess even covers any of the answer, so if anyone could help, it would be greatly appreciated :-).

like image 826
rubixibuc Avatar asked Dec 17 '22 09:12

rubixibuc


2 Answers

You can think of a left-balanced binary tree as a balanced binary tree where the left sub-tree of each node is filled before the right sub-tree. In more informal terms, this is a tree wherein the nodes at the bottom-most level are all on the left side of the entire tree.

Take this tree for example:

enter image description here

This tree is balanced, but not left-balanced. If node 67 were removed, however, the tree would be left-balanced.

like image 144
Brandon E Taylor Avatar answered Jan 13 '23 19:01

Brandon E Taylor


It seems to me that the definition of left balanced binary tree is the same of complete binary tree.

like image 30
Simone Avatar answered Jan 13 '23 19:01

Simone