Basic |
In this structure, the elements are arranged sequentially or linearly and attached to one another. |
In this structure, the elements are arranged hierarchically or non-linear manner. |
Types |
Arrays, linked list, stack, queue are the types of a linear data structure. |
Trees and graphs are the types of a non-linear data structure. |
implementation |
Due to the linear organization, they are easy to implement. |
Due to the non-linear organization, they are difficult to implement. |
Traversal |
As linear data structure is a single level, so it requires a single run to traverse each data item. |
The data items in a non-linear data structure cannot be accessed in a single run. It requires multiple runs to be traversed. |
Arrangement |
Each data item is attached to the previous and next items. |
Each item is attached to many other items. |
Levels |
This data structure does not contain any hierarchy, and all the data elements are organized in a single level. |
In this, the data elements are arranged in multiple levels. |
Memory utilization |
In this, the memory utilization is not efficient. |
In this, memory is utilized in a very efficient manner. |
Time complexity |
The time complexity of linear data structure increases with the increase in the input size. |
The time complexity of non-linear data structure often remains same with the increase in the input size. |
Applications |
Linear data structures are mainly used for developing the software. |
Non-linear data structures are used in image processing and Artificial Intelligence . |