Difference between Linear and Non-linear Data Structures

Data StructureDatabaseData Storage

Linear Data Structures

A Linear data structure have data elements arranged in sequential manner and each member element is connected to its previous and next element. This connection helps to traverse a linear data structure in a single level and in single run. Such data structures are easy to implement as computer memory is also sequential. Examples of linear data structures are List, Queue, Stack, Array etc.

Non-linear Data Structures

A non-linear data structure has no set sequence of connecting all its elements and each element can have multiple paths to connect to other elements. Such data structures supports multi-level storage and often cannot be traversed in single run. Such data structures are not easy to implement but are more efficient in utilizing computer memory. Examples of non-linear data structures are Tree, BST, Graphs etc.

Following are the important differences between Linear Data Structures and Non-linear Data Structures.

Sr. No.KeyLinear Data StructuresNon-linear Data Structures
1Data Element ArrangementIn linear data structure, data elements are sequentially connected and each element is traversable through a single run.In non-linear data structure, data elements are hierarchically connected and are present at various levels.
2LevelsIn linear data structure, all data elements are present at a single level.In non-linear data structure, data elements are present at multiple levels.
3Implementation complexityLinear data structures are easier to implement.Non-linear data structures are difficult to understand and implement as compared to linear data structures.
4TraversalLinear data structures can be traversed completely in a single run.Non-linear data structures are not easy to traverse and needs multiple runs to be traversed completely.
5Memory utilizationLinear data structures are not very memory friendly and are not utilizing memory efficiently.Non-linear data structures uses memory very efficiently.
6Time ComplexityTime complexity of linear data structure often increases with increase in size.Time complexity of non-linear data structure often remain with increase in size.
7ExamplesArray, List, Queue, Stack.Graph, Map, Tree.
raja
Published on 28-Nov-2019 11:21:20
Advertisements