Linear vs. non-linear data structure
Overview
The data structure is a way of classifying data so that it can be stored and used efficiently. Data structure comes in two basic types. One is a linear data structure, and the second is a non-linear data structure.
Linear data structure
In the linear data structure, data elements are organized subsequently. Each element is linked with its previous and next elements. The user can traverse all elements in a single run, as elements exist at a single level.
Non-linear data structure
In the non-linear data structure, data elements are stored in a non-contiguous manner. Hierarchy is achieved somehow as data elements are arranged on multiple levels.
Comparison
Attributes | Linear data structure | Non-linear data structure |
Arrangement | Sequential | Non sequential |
Types | Arrays, Linked list, Stack, Queue | Trees and graphs |
Levels | Single Level | Mutiple Levels |
Implementation | Easy | Difficult |
Efficiency | Not good enough for complex programs | Works well with high complexity programs |
Applications | Undo redo, Job scheduling, Media players | AI, Robotics, Neural Networks |
Traversal | Single run | Multiple runs |
Memory Utilization | Inefficient | Efficient |
Time Complexity | Increases as input size increase | Remains same |
Free Resources