__Basics of Tree Data Structure PART - 1 __

- Tree is a non-linear data structure which organizes data in a hierarchical structure and this is a recursive definition.
- A tree is a connected graph without any circuits/cycles.

**Tree Terminology-**

The important terms related to tree data structure are-

__1. Root-__

- The first node from where the tree originates is called as a root node.
- In any tree, there must be only one root node.
- We can never have multiple root nodes in a tree data structure.

Here, node A is the only root node.

__2. Edge-__

- The connecting link between any two nodes is called as an edge.
- In a tree with n number of nodes, there are exactly (n-1) number of edges.

- The node which has a branch from it to any other node is called as a parent node.
- In other words, the node which has one or more children is called as a parent node.
- In a tree, a parent node can have any number of child nodes.

Here,

- Node A is the parent of nodes B and C
- Node B is the parent of nodes D, E and F
- Node C is the parent of nodes G and H
- Node E is the parent of nodes I and J
- Node G is the parent of node K

__4. Child-__

- The node which is a descendant of some node is called as a child node.
- All the nodes except root node are child nodes.

Here,

- Nodes B and C are the children of node A
- Nodes D, E and F are the children of node B
- Nodes G and H are the children of node C
- Nodes I and J are the children of node E
- Node K is the child of node G

- Nodes which belong to the same parent are called as siblings.
- In other words, nodes with the same parent are sibling nodes.

- Nodes B and C are siblings
- Nodes D, E and F are siblings
- Nodes G and H are siblings
- Nodes I and J are siblings

**Degree of a node**is the total number of children of that node.**Degree of a tree**is the highest degree of a node among all the nodes in the tree.

Here,

- Degree of node A = 2
- Degree of node B = 3
- Degree of node C = 2
- Degree of node D = 0
- Degree of node E = 2
- Degree of node F = 0
- Degree of node G = 1
- Degree of node H = 0
- Degree of node I = 0
- Degree of node J = 0
- Degree of node K = 0

Remaining Tree Terminologies are discussed in my next article (Basics of Tree Data Structure PART - 2)

Please Like if you felt it useful.

If you have any doubts please mention in the Comment Section.(To Do comment Please Sign in)

## Comments