General morphology of data structures is shown in figure 3.
Morphology of Data Structures
There are two aspects of managing data structures, namely, logical and physical.
A. Logical Data Structures
- Linear Structures
The most common organization for data is a linear structure. A structure is linear if it has these two properties :
Property 1: Each element of the structure is followed by at most one other element
Property 2: No two elements are followed by the same element
An array is an example of a linearly structured data type. We generally write a linearly structured data type like this ABCD.
Counter example 1: If property 1 violates, then BAC, A points to two elements. This example is tree which is non-linear structure. Trees are acyclic structures.
Counter example 2 : If property 2 violates, then ACB, A and B both points to C. This is graph which is again non-linear structure.
Other common linear structure like linked lists, stack & queue are shown above in the picture depicting morphology of the Data Structures.
Non-Linear Structures
In a non-linear structure there is no limit on the number of predecessors or successors of an element of the structure. An element may have a number of successors or predecessor. These structures violate both properties of linear structure. Trees and graphs are the important examples.
A tree is a collection of nodes, where every node has a unique predecessor, but it can have many successors. A Graph is also a collection of nodes. In graph, any node can have any number of successors and predecessors, as shown in figure.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment