We always get confused with binary trees and binary search trees. As we have seen in the definition, BST is a sorted binary tree. If it is sorted, then we can have the performance improvement compared to a regular binary tree. Each binary tree node can have a maximum of two child nodes, which are known as the left child node and right child node. However, based on the type of binary tree, there can be zero, one, or two child nodes.
We can also classify binary trees into different categories:
- Full binary tree: A full binary tree is a tree that has either zero or two child nodes on each node. A full binary tree is also known as a proper tree or a plane binary tree.
- Perfect binary tree: A perfect binary tree is a binary tree in which all internal nodes have exactly two child nodes and all leaves have the same level or depth.
- Complete binary tree: A complete...