Trees
Basic terminology and proprery
By Bharati.C
M.Tech
Tree:
A tree is a connected acyclic graph.
Ex:
a b
d
g
c
f
Important property of tree
1. In a tree no. of edges one less than
vertices.
|E|=|V|-1
2. Rooted tree: select an arbitrary
vertex in a tree consider as the root so
called rooted tree.
It always placing top(level 0)
Ex:
i
b a
d
e
f
c
h g
Free tree
a
b d e
c g
h i
f
Rooted tree
Basic terminology of tree
• Root: top most node of the tree.
• Child: nodes next in the hierarchy.
• Parent: the node having further sub-branches is
called parent node.
• Siblings: nodes having same parent elements.
• Leaves: there are the last node of the tree.
• Height of tree: height of its root.
• Depth of tree: the no. of nodes on the path from
the root to the node.
Example:
a
b
e
c
d f
h
g
root
Parent nodes
siblings
leaves
Height of the tree=2
Depth of the tree=3
Ordered tree
an ordered tree is rooted tree which all its nodes
are ordered left and right.
Ex: binary tree
binary tree is an ordered tree which every node
has no more then two children and each
designated either left or right child.
Ordered tree always left node less then and
right child greater than parent node.
Example
10
8 12
7 9 11 13

Trees

  • 1.
    Trees Basic terminology andproprery By Bharati.C M.Tech
  • 2.
    Tree: A tree isa connected acyclic graph. Ex: a b d g c f
  • 3.
    Important property oftree 1. In a tree no. of edges one less than vertices. |E|=|V|-1 2. Rooted tree: select an arbitrary vertex in a tree consider as the root so called rooted tree. It always placing top(level 0)
  • 4.
    Ex: i b a d e f c h g Freetree a b d e c g h i f Rooted tree
  • 5.
    Basic terminology oftree • Root: top most node of the tree. • Child: nodes next in the hierarchy. • Parent: the node having further sub-branches is called parent node. • Siblings: nodes having same parent elements. • Leaves: there are the last node of the tree. • Height of tree: height of its root. • Depth of tree: the no. of nodes on the path from the root to the node.
  • 6.
  • 7.
    Ordered tree an orderedtree is rooted tree which all its nodes are ordered left and right. Ex: binary tree binary tree is an ordered tree which every node has no more then two children and each designated either left or right child. Ordered tree always left node less then and right child greater than parent node.
  • 8.