Binary Tree Datastructure
Binary Tree Datastructure
In a normal tree, every node can have any number of children. A binary tree is a special type
of tree data structure in which every node can have a maximum of 2 children. One is known
as a left child and the other is known as right child.
A tree in which every node can have a maximum of two children is called Binary Tree.
In a binary tree, every node can have either 0 children or 1 child or 2 children but not more
than 2 children.
Example
A binary tree in which every node has either two or zero number of children is called Strictly
Binary Tree
Strictly binary tree is also called as Full Binary Tree or Proper Binary Tree or 2-Tree
Example
A binary tree in which every internal node has exactly two children and all leaf nodes are
at same level is called Complete Binary Tree.
Complete binary tree is also called as Perfect Binary Tree
The full binary tree obtained by adding dummy nodes to a binary tree is called as Extended
Binary Tree.
In above figure, a normal binary tree is converted into full binary tree by adding dummy
nodes (In pink colour).
Binary Tree Representations
A binary tree data structure is represented using two methods. Those methods are as
follows...
1. Array Representation
2. Linked List Representation
To represent a binary tree of depth 'n' using array representation, we need one dimensional
array with a maximum size of 2n + 1.