What is the Difference Between Complete Binary Tree and Full Binary Tree?
🆚 Go to Comparative Table 🆚The main differences between a complete binary tree and a full binary tree are as follows:
- Node fillings: A full binary tree has all nodes, except the leaf nodes, filled with children of size 2, meaning all nodes have exactly 2 children. In a complete binary tree, all nodes have either 0 or 2 children, but the leaf nodes need not be filled with children of size 2.
- Leaf nodes: In a full binary tree, leaf nodes do not necessarily have to be at the same level. In a complete binary tree, all leaf nodes must be in the same depth.
- Node order: A complete binary tree requires that nodes be filled from the left to right, while there is no specific order for filling nodes in a full binary tree.
- Applications: Complete binary trees are mainly used in heap-based data structures. Full binary trees, also known as proper binary trees or 2-trees, do not have specific applications but are sometimes referred to as a full binary tree.
In summary, a complete binary tree is a special type of binary tree where all nodes are filled from the left to right and all leaf nodes are at the same depth, while a full binary tree has all nodes, except the leaf nodes, filled with exactly 2 children, and leaf nodes may not be at the same level.
On this pageWhat is the Difference Between Complete Binary Tree and Full Binary Tree? Comparative Table: Complete Binary Tree vs Full Binary Tree
Comparative Table: Complete Binary Tree vs Full Binary Tree
Here is a table comparing the differences between a Complete Binary Tree and a Full Binary Tree:
Complete Binary Tree | Full Binary Tree |
---|---|
In a complete binary tree, all levels are completely filled except possibly the last level. | In a full binary tree, all nodes have either 0 or 2 offspring. |
The last level of a complete binary tree is filled from left to right. | There is no specific order of filling nodes in a full binary tree. |
Complete binary trees are mainly used in heap-based data structures. | Full binary trees have no specific application but are also called proper binary trees or 2-trees. |
A complete binary tree must have all leaves at the same depth. | In a full binary tree, leaf level does not necessarily have to be at the same depth. |
Examples of complete binary trees are often used in heap data structures, such as binary heap and binomial tree. Full binary trees, on the other hand, do not have any specific applications but are used to represent proper binary trees.
Read more:
- Binary Tree vs Binary Search Tree
- Graph vs Tree
- Complete vs Finish
- Tree vs Graph in Data Structure
- Tree vs Plant
- Binary vs Decimal
- Queen vs Full
- Full vs Double Bed
- Deciduous vs Coniferous Trees
- Binary Search vs Linear Search
- Incomplete vs Complete Metamorphosis
- Deciduous vs Evergreen Trees
- Binary vs ASCII
- Stem vs Trunk
- Full vs Twin Bed
- Sapling vs Seedling
- TreeSet vs TreeMap
- HashMap vs TreeMap
- Wood vs Forest