DATA STRUCTURES

Trees

Tree

Tree is a non linear data structure. it is the collection of entities which are known as nodes linked together to simulate hierarchy,

Terminologies


Degree of a node: it is a number of sub-tree in a given tree
Degree of a tree: maximum number of nodes in a given tree

leaf: A node that doesn’t have any child is known as leaf node or terminal node or a degree with 0


non terminal:

All other nodes with at least one node are known as internal node or non terminal nodes
Any node (except the root node) whose degree is not 0 is called non terminal node


sibling :

the children node of a given parent node is called sibling
level:

the entire tree structure is leveled in such a way that the root node is always level 0. if a node is at level n then the child will be at level n+1
Edge: 

it is a connecting line of two nodes . it is also called as link. Every node accept the root node has an incoming edge.Path:-it is sequence of consecutive edges from source node to destination node is known as path .
Depth: 

it is the maximum level of any node in a given tree. depth of root node is always 0.
High:

height of a tree is equal to maximum depth   or  maximum distance
height of node: 

No  of edges in the longest path from this node to n leaf
forest : 

Set of disjoint trees , in a given tree if you remove the root node the it becomes new trees

Applications of trees
easy traversing
easy search
insertion
deletion

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button