Root Node
Root NodeIt is a component of the tree. It is the first node in the tree data structure and therefore has no parent node.
Tree and root node
A tree is composed of a root node and several subtrees. It is a finite set of n (n>0) nodes, where:
- Each element is called a node. A tree is composed of a set and a relationship defined on the set. The elements in the set are called nodes of the tree, and the relationship defined is a parent-child relationship.
- The parent-child relationship establishes a hierarchical structure between the nodes of the tree. In this hierarchy, there is a node with a special status, which is called the root node or the root of the tree.
- The remaining data elements except the root node are divided into m (m≥0) disjoint sets T1, T2,…, Tm-1, where each set Ti (1 <= i <= m) is itself a tree, called a subtree of the original tree.
Properties of the root node
A root node is a part of a data structure consisting of one or more fields that have links to other nodes and contain data fields; the root node is the first node of the tree, and any node can be a root node in relation to itself and its children if that part of the tree is chosen objectively.