J.E.D.I
5.4.3.1 Preorder Sequential Representation
In this sequential representation, the elements are listed in its preorder sequence and two additional vectors are kept – RLINK and LTAG. RLINK is a pointer from an older to a
next younger brother in the forest, or from a father to his right son in its binary tree representation. LTAG is an indicator if a node is terminal leaf node and the symbol
is used.
The following is the preorder sequential representation of the forest F:
In the implementation, the following is the actual internal representation:
RLINK contains the node pointed to by the current node and LTAG has a value of 1 for every in the representation.
Since a terminal node always immediately precedes a node pointed to by an arrow except the last node in the sequence, the use of data can be lessened by
1Eliminating LTAG; or 2Replacing RLINK with RTAG that simply identifies the nodes where an arrow emanates
Using the second option will need a stack to establish the relation between nodes since the arrows have the “last in, first out” structure, and using it leads to the following
representation:
and this is internally represented as follows:
Data Structures 79
J.E.D.I
Having bit values for RTAG and LTAG, the last option clearly shows the least space required for storage. However, it entails more computations in retrieving the forest.
5.4.3.2 Family-Order Sequential Representation
In this sequential representation, the family-order listing of elements is used in the representation. In family-order traversal, the first family to be listed consists of the root
nodes of all trees in the forest and subsequently, the families are listed on a last-in first-out basis. This representation makes use of LLINK and RTAG. LLINK is a pointer to
the leftmost son of a node or the left son in the trees binary representation. RTAG identifies the youngest brother in a brood or the last member of the family. The following
is the family-order sequential representation of the forest F:
In the implementation, the following is the actual internal representation:
Just like in preorder sequential representation, since an RTAG value always immediately precedes an arrow except for the last node in the sequence, an alternative structure is to
replace LLINK with LTAG, which is set if an arrow emanates from it:
Data Structures 80
J.E.D.I
and internally represented as:
5.4.3.3 Level-Order Sequential Representation