Professional Documents
Culture Documents
Data Structure
Types of Trees Data Structure
1)General tree
2) Binary Tree
3)Binary Search Tree
4)AVL Tree or height balanced
binary tree
5) B-tree
6) B+ tree
7)N-ary Tree
8)Skewed Tree
General tree
B C
B C
E D
F G H I
General tree -: Each node in a general tree is
likely to have different number of children .
For ex some may have 2 ,some may have 3
or 4 etc
A
A
B C
B C
4 D
Structure of Node
Struct node{
Struct node *left;
Int val;
Struct node *right;
}a1,a2,a3;
100 4 200
A1
5 6
100 A2 200 A3
Types of Binary tree
4 5
6 7
• Perfect binary tree: All nodes have two children and all
leaves are at the same level.
4 5
6 7
8 9 6 7
Complete binary tree
5 6
7 8
Balanced binary tree
Balanced Binary Tree is a Binary tree in which height of
the left and the right sub-trees of every node may differ
by at most 1.
Left sub-tree height - Right sub-tree height <=1
4 5
0-2 1 3-1 6 7
3
2
al ree
a ree
d
ed
c e
c
t ry t
t ry t
n
n
a
5
l
N ina
N ina
4
B
B
b
b
o
6
Degenerate tree