Professional Documents
Culture Documents
Introduction:
Edges: Link between two nodes. Each node is connected to the next node using edges. In the
above diagram, A node is connected to node B through a right edge and A node is connected
to node C is connected through left edge.
Root Node: Topmost node of a tree is the root node. Each tree will have only one root node.
In above diagram Node A is the Root Node.
Parent Node: Parent node is a node which is not the Root node. Parent node has an edge
upwards towards the parents. Parent node has a child node.
Node B is parent to Nodes D and E, Node C is parent to Nodes F and G, Node D is parent to
Node H and I, Node E is parent to Node J.
Child Node: The node below a parent node which has an edge downwards is called the Child
node.
Node D and E are child node of Parent B, Node F and G are child nodes of Parent C, Nodes H
and I are child nodes of Parent D, J node is child node of Parent E.
Leaf Node: Node which does not have any child nodes is called leaf node.
Nodes F, G, H, I and J are leaf nodes.
In other linear data structures like arrays, queues, stacks and linked list data is store sequentially. In
order to perform any operation in a linear data structure the time complexity increases with increase
in data size. Different tree data structures allow quicker and easier access to the data as it is a non-
linear data structure. Trees data structure represents the memory arrangement of a computer
system.
Types Of Trees:
a) General Tree:
b) Binary Tree.
d) AVL Tree.
e) Red-Black Tree.
f) N-ary T