Write a short note on Internal trees. Explain with an example.


Q.) Write a short note on Internal trees. Explain with an example.

Subject: Data Structures - II

Internal Trees: Internal trees, also known as plane trees or ordered trees, are rooted trees in which each node is assigned an integer label and the labels of the children of any node are consecutive. This type of tree has applications in various fields, including graph theory, computer science, linguistics, and biology.

Definition: Formally, an internal tree T = (V, E) is a rooted tree with a set of nodes V and a set of edges E, where each node v ∈ V is assigned a unique integer label lv, and the labels of the children of any node u ∈ V are given by lv+1, lv+2, ..., lv+k for some k ≥ 0.

Properties:

  1. Root Node: Every internal tree has a unique root node, which is the node with label 1.
  2. Level: The level of a node v in an internal tree is defined as the length of the path from the root node to v. The root node is at level 1, and its children are at level 2, and so on.
  3. Degree: The degree of a node v in an internal tree is the number of children it has.
  4. Leftmost and Rightmost Nodes: For any node u ∈ V with children, the leftmost child is the child with label lv+1, and the rightmost child is the child with label lv+k.
  5. Number of Nodes: The number of nodes in an internal tree with n internal nodes is given by (n+2)/2.

Example: Consider the following internal tree T:

         1
       /   \
     2       6
    / \     / \
   3   5   7   9
                  \
                   8

In this tree:

  • The root node is labeled 1.
  • The leftmost and rightmost nodes at level 2 are labeled 2 and 6, respectively.
  • The leftmost and rightmost nodes at level 3 are labeled 3 and 5, respectively.
  • The leftmost and rightmost nodes at level 4 are labeled 7 and 9, respectively.

Applications: Internal trees are used in various domains due to their properties and structure. Some of the applications include:

  • Graph Theory: Internal trees are used to represent various graph structures, such as minimum spanning trees and phylogenetic trees.
  • Computer Science: They are used in algorithm design, data structures, and parsing techniques.
  • Linguistics: Internal trees are employed in the parsing and analysis of natural languages.
  • Biology: They are utilized in representing evolutionary relationships between species and phylogenetic trees.

In summary, internal trees are rooted trees with consecutive integer labels assigned to their nodes. They possess several properties related to levels, degrees, and the positions of leftmost and rightmost nodes. Their applications span various fields, where they are used to represent and analyze different types of data and structures.