The chapter says that a binary tree is said to be a perfect binary tree if it is both full and complete.
I am confused with this definition and would like someone to correct my understanding.
Consider the following tree
1
/ \
2 3
/ \
4 5
- A full binary tree is a binary tree in which every node has either 0 or 2 children.
- A complete binary tree is a binary tree in which all levels, except possibly the last, are completely filled, and all nodes are as left as possible.
From the above 2 definitions, the provided tree is both full and complete. Hence, does it mean it is also a perfect tree or not?
Course: Data Structures for Coding Interviews in C++ - Learn Interactively
Lesson: https://www.educative.io/courses/data-structures-coding-interviews-cpp/what-is-a-binary-tree