Page 185 - DCAP407_DATA_STRUCTURE
P. 185
Data Structure
need to compare the characteristics of the data structures before choosing the right data structure. A tree
is a hierarchical data structure suitable for representing hierarchical information. The tree data structure
has the characteristics of quick search, quick inserts, and quick deletes.
10.1 Trees
A tree is a very important data structure as it is useful in many applications. A tree structure is a
method of representing the hierarchical nature of a structure in a graphical form. It is termed as "tree
structure" since its representation resembles a tree. However, the chart of a tree is normally upside
down compared to an actual tree, with the root at the top and the leaves at the bottom.
The figure 10.1 depicts a tree structure, which represents the hierarchical organization of books.
Figure 10.1: Tree Structure of Books
In the hierarchical organization of books shown in figure 10.1, Books is the root of the tree. Books can
be classified as Fiction and Non-fiction. Non-fiction books can be further classified as Realistic and
Non-realistic, which are the leaves of the tree. Thus, it forms a complete tree structure.
Trees are primarily treated as data structures rather than as data types.
A tree is a widely-used data structure that depicts a hierarchical tree structures with a set of linked
nodes. The elements of data structure in a tree are arranged in a non-linear fashion i.e., they use two
dimensional representations. Thus, trees are known as non-linear data structures. This data structure is
more efficient in inserting additional data, deleting unnecessary data, and searching new data.
Genealogies and organizational charts are the most familiar applications of trees.
Few other applications of tree data structures are as follows:
1. To analyze electrical circuits
2. To represent the structure of mathematical formulas
3. To organize information in database systems
4. To represent syntactic structure of source programs in compilers
178 LOVELY PROFESSIONAL UNIVERSITY