I am reading the book "Cracking the coding interview". In Chapter 4 they cover basic tree concepts.
It says there that a complete binary tree is a binary tree in which every level of the tree is fully filled, except for perhaps the last level. To the extent that the last level is filled, it is filled left to right. Thus, the following binary tree is complete:
1
2 3
4 5 6
A full binary tree is a binary tree in which every node has either zero or two children. This is clear and self-explanatory.
Now, a perfect binary tree is the one that is both full and complete. It is said that in a perfect binary tree all leaf nodes will be at the same level, and this level has the maximum number of nodes.
However, the following binary is full and complete (according to the given definition), but it does not have all of the levels completely filled:
1
2 3
4 5
Can someone experienced in this terminology clarify this point? It looks like a mistake in the definition.