# Data Structure Tree

Data Structure **Tree** is a hierarchical relationship between various elements. It is a set of one or more nodes and nodes are connected by an edge. Each node contains some value. The node is represented by a circle and edge lives connecting these nodes. Tree is a non linear data structure, which is very flexible, versatile and widely used.

In the above tree, **A** is the root element and it has two subtree **B** and **C**. **B** is itself root element of **D** and **E**. And similarly **C** is the root element of **F** and **G**.

## Tree Terminology

These are the different terminology used in the tree.

**Leaf Node**- Any node with degree 0 or that has no children is called a terminal node or leaf node.**Level of Node**- The level of any node is the length of its path from the root.**Root Node**- The topmost node of the tree.**Sub Trees**- The branches of the root node are called sub trees.**Path**- The sequence of the edges is called a path.**Degree**- The degree of the node is equal to the number of the children that a node has.

## Tree Types

**These are the following six tree types.**

2. Forests

3. Binary trees

4. Binary search trees

5. Expression trees

6. AVL Tree

7. B Tree