Types of Binary Trees
Overview of various types of binary trees
Types of Binary Trees
Full Binary Tree
- Each node has either 0 or 2 children.
- No node has just 1 child.
Complete Binary Tree
-
All levels are completely filled except possibly the last.
-
Fill levels from left to right.
Perfect Binary Tree
-
All levels are full.
-
Every parent has 2 children.
-
All leaves at same level.
Balanced Binary Tree
-
Height difference between left and right subtrees is at most 1.
-
Balance applies at every node in the tree.
-
Does not require all levels to be full.
Skewed Binary Tree
-
All nodes form a straight line, resembling a linked list.
-
Can be left-skewed (all children are on the left) or right-skewed (all children are on the right).
-
Height of the tree is equal to the number of nodes, making it inefficient for operations like searching or insertion.
Binary Search Tree (BST)
-
Left child contains values smaller than the parent.
-
Right child contains values greater than the parent.