Applications, Advantages and Disadvantages of Tree
Tree is a non-linear data structure. It consists of nodes and edges. A tree represents data in a hierarchical organization. It is a special type of connected graph without any cycle or circuit.
- Node: Node is the main component of a tree that stores the data along with the links to other nodes.
- Edge: Edge( also called branch) connects two nodes of a tree. A node can have more than one edge.
- Parent: Parent node is a predecessor to any other node. In simple words, it is a node in the tree that has branches to other nodes.
- Child: The node which is connected below to another node is called a child of that node. All nodes except the root node are child nodes.
- Root: The first node of the tree which originates it is called the root of the tree. A tree can have only one root.
- Leaf node(External node): Nodes with no child are called leaf nodes or external nodes.
- Internal node(Non-Leaf node): Nodes with at least one child is called an internal node or non-leaf nodes.
- Siblings: Nodes having the same parent are called siblings.
- Cousins: The nodes belonging to the same level with different parent nodes.
- Degree: Degree of a node is defined as the number of children of that node. The degree of the tree is the highest degree of a node among all the nodes.
- Path: The nodes in the tree has to be reachable from other nodes through a unique sequence of edges called path. The number of edges in a path is called the length of the path.
- Level of a node: The level of a node is defined as the number of edges in the unique path between the root and the node.
- Subtree: A tree formed by a node and all of its descendants in the tree is called a subtree.
Applications of Tree:
- Trees can be used to store data which are in hierarchical form.
- Different types of trees are used in various fields like in databases, computer graphics, computer networks.
- Tree data structure are used by operating system to manage file directory.
Real-Time Applications of Tree :
- Databases use tree data structure for indexing.
- Tree data structure is used in file directory management.
- DNS uses tree data structure.
- Trees are used in several games like moves in chess.
- Decision based algorithms in machine learning uses tree algorithms.
Advantages of Tree:
- Trees provide hierarchical representation for the data.
- Trees are dynamic in nature so the number of nodes are not limited.
- Insertion and deletion in a tree can be done in moderate time.
Disadvantages of Tree:
- Some trees can only be stored using sequential or chained storage.