Types of Data Structures :
Linear Data Structures :
- A data structure is said to be linear if its elements form a sequence or a linear list.
- In this type, elements are accessed in sequential order but it is not compulsory to store all elements sequentially.
- Linear data structures traverses the data elements sequentially. In linear data structures, only one data elements can directly be reached.
- Linear data structure includes array, linked list, stack and queues.
Non-linear Data Structures :
A data structure is said to be non-linear if
its elements form a hierarchical classification where, data items appear at
various level. In this type of data structure, the elements do not form a
sequence.
Trees and Graphs are widely used
non-linear data structures.
In non-linear data structures,
every data elements may have more than one predecessor as well as successor.
Primitive and Non primitive data Structures :
- Primitive data structure defines a set of primitive elements which do not involve any other elements as its sub-parts, for example, data structure defined for integers and characters. These are generally primary or builts in data types in programming language.
- Non-primitive data structures are those which define a set of derived elements such as array. Array data structures defined in C consists of a set of similar type of elements.. While structure is another example of non-primitive data type while consists of a set of element Which many be of different data types.
- Hence, int, char, float and double are primitive data types of language C and array structure and user defined data types are non-primitive data structures.
Static Data Structure :
- In Static Data structure the size of the structure is fixed. The content of the data structure can be modified but without changing the memory space allocated to it.
- A data structure is referred as static data structure if it is created before program execution begins.
- The variables of static data structure have user specified names.
- Array is static data structure.
Dynamic Data Structure :
- In Dynamic data structure the size of the structure in not
fixed and can be modified during the operations performed on it. Dynamic data
structures are designed to facilitate change of data structures in the run
time.
- A data structure which is created at run time, is called as
Dynamic data structure.
- Linked lists is a dynamic data structure when realized using
dynamic memory management and pointer.
- Non-linear data structures are generally implemented in a
same way as linked list.
- Hence trees and graphs can be implemented as dynamic data
structures whereas arrays is a static data structure.
Difference Between Linear and Non Linear Data Structures :
Linear Data Structures |
Non-Linear Data Structures |
Data
elements are arranged in a linear order. |
Data
elements are attached in hierarchically manner. |
Single level
is involved. |
Multiple
levels are involved. |
Data items
can be traversed in single run |
Data items
can not be traversed in a single run |
These are
easy to implement in the computer’s memory. |
There are
difficult to implements in the computer’s memory. |
Memory is
not utilized in an efficient way |
Memory is
utilized in an efficient way. |
organized in
a way similar to how the computer memory is organized |
Organized in
a different way then the computer’s memory |
Examples :
Array, Linked List, Stack and Queue |
Example
: Tree, Graph |
No comments:
Post a Comment