Difference between Linear and Non-linear Data Structures
Linear Data Structure -
-> The data structure where data items are organized sequentially or linearly where data elements attached one after another is called linear data structure. Data elements in a liner data structure are traversed one after the other and only one element can be directly reached while traversing. All the data items in linear data structure can be traversed in single run.
-> These kind of data structures are very easy to implement because memory of computer is also organized in linear fashion.
-> Examples of linear data structures are Arrays, Stack, Queue and Linked List.
Non-linear Data Structure -
-> The data structure where data items are not organized sequentially is called non linear data structure. In other words, A data elements of the non linear data structure could be connected to more than one elements to reflect a special relationship among them. All the data elements in non linear data structure can not be traversed in single run.
-> Examples of non linear data structures are Trees and Graphs.
Linear Data Structure -
-> The data structure where data items are organized sequentially or linearly where data elements attached one after another is called linear data structure. Data elements in a liner data structure are traversed one after the other and only one element can be directly reached while traversing. All the data items in linear data structure can be traversed in single run.
-> These kind of data structures are very easy to implement because memory of computer is also organized in linear fashion.
-> Examples of linear data structures are Arrays, Stack, Queue and Linked List.
Non-linear Data Structure -
-> The data structure where data items are not organized sequentially is called non linear data structure. In other words, A data elements of the non linear data structure could be connected to more than one elements to reflect a special relationship among them. All the data elements in non linear data structure can not be traversed in single run.
-> Examples of non linear data structures are Trees and Graphs.
Linear Data Structure
|
Non-Linear Data Structure
|
Every item is related to its
previous and next item.
|
Every item is attached with many
other items.
|
Data is arranged in linear
sequence.
|
Data is not arranged in sequence.
|
Data items can be traversed in a
single run.
|
Data can not be traversed in a
single run.
|
Examples: Array, Stack, Queue,
Linked List.
|
Examples: Tree, Graph.
|
Implementation is Easy.
|
Implementation is Difficult.
|