There are different types of binary tree but here we are going to discuss about the difference of Complete binary tree and Full binary tree.
Full Binary Tree:
A full binary tree is a binary tree in which all of the nodes have either 0 or 2 offspring. In other terms, a full binary tree is a binary tree in which all nodes, except the leaf nodes, have two offspring.
Let, i be the number of internal nodes n be the total number of nodes l be number of leaves Ξ» be number of levels
Then,
The number of leaves is (i + 1). The total number of nodes is (2i + 1). The number of internal nodes is (n β 1) / 2. The number of leaves is (n + 1) / 2. The total number of nodes is (2l β 1). The number of internal nodes is (l β 1). The number of leaves is at most (2Ξ» - 1).
Complete Binary Tree:
A binary tree is said to be a complete binary tree if all its levels, except possibly the last level, have the maximum number of possible nodes, and all the nodes in the last level appear as far left as possible.
All of the nodes have either 0 or 2 offspring, therefore, it is a Full binary tree.
It is not a Complete binary tree because node B has no children whereas node C has children, and according to a complete binary tree, nodes should be filled from the left side.
Hence, the binary tree shown above is a Full binary tree and it is not a Complete binary tree.