tree in data structure

A tree in data structure

is a finite non empty sets of element, one of these elements is called the root and remaining elements are partition into trees which are called sub tree of tree.



In other words a tree is a collection of mode and each node is linked with other nodes with the help of branch. The nodes are connected in such a way that they have no loops and there is a special node called the root.



A tree is a cyclic simple, connected graph. A tree contains no loop and no cycle.

There is no more than one edge between any pair of nodes.


Tree terminology


Node    each element of a tree is called node.

Root   it is the  first node in the hierarchical arrangements of data items in the above tree a is the root node.

Parent    parent of a node is the immediate predecessor of a node. 
tree in data structure

Example – here  B  is the parent of D and E.

Child    each immediate successor of a nodes is known as child. in the above figure  B  and  C  is the child of  A.

Swiveling     the child node of a given parents code  is called  swiveling.