Data structures is used to structure data so that it can be used by the users in efficient way. As the computer program relies hugely on the data and also requires a large volume of data for its performance, therefore it is highly important to arrange the data. This arrangement of data in organized structures is known as a data structure.
Storing of the data in data structures allows the access, modifications, and other operations that can be carried over the data elements. The arrangement of the data is mainly done in a computer and therefore proper algorithms are required to carry on operations with the data structures. Reducing space and decreasing the time complexity of different tasks is the main aim of data structures.
Arrangement of the data within a data structure can follow different orders, therefore a data structure is classified according to the way of arrangement of its data. There are two types of data structures.
- Primitive data structure
- Non-primitive data structure
The primitive type of data structure includes the predefined data structures such as char, float, int, and double.
The non-primitive data structures are used to store the collection of elements. This data structure can be further categorized into
What is the Linear data structure?
A linear data structure is a structure in which the elements are stored sequentially. You can check it detail article here. Types of linear data structures are Array, Queue, Stack, Linked List and hash tables.
What is a Non-linear data structure?
A non-linear data structure is also another type of data structure in which the data elements are not arranged in a contiguous manner.
Type of non-linear data structure are Trees and Graphs . You can check detailed article on it Here.
Difference between Linear and non Linear data structure
Linear Data structure | Non-Linear Data structure |
---|---|
In this data elements are arranged sequentially or linearly. | In this data element are arranged hierarchically or in non-linear manner. |
Its examples are arrays, linked list, stack, queue and Hash tables. | Its Example are trees and graphs. |
Its memory utilization is not efficient. | Its memory utilization is efficient as compared to Linear data structure. |
Linear data structures are basically used for developing the complex software. | Non-linear data structures are mainly used in (AI) Artificial Intelligence. |
In this data elements are organized in a single level. | In this data elements are organized in multiple levels. (e.g. is Tree structure) |
Each data element is mapped to the next and previous items. | Each data element can be attached to many other items. |