Search⌘ K

Overview of Linear & Non-Linear Data Structures

Understand the characteristics and performance of linear and non-linear data structures to select the right data structure for your algorithms. Learn about common examples like arrays, linked lists, trees, graphs, and hash tables along with their insertion, deletion, and search time complexities in JavaScript.

Now that we have covered all the popular data structures, let’s see which of them are linear and which are non-linear. This information is useful when deciding the appropriate data structure for our algorithm.

Linear Data Structures

In linear data structures, each element is connected to either one (the next element) or two (the next and previous) more elements. Traversal in these structures is linear, meaning that insertion, deletion, and search work in O(n).

Arrays, linked lists, stacks, and queues are all examples of linear data structures.

Non-Linear Data Structures

The opposite of linear data structures is non-linear data structures. In a non-linear data structure, each element can be connected to several other data elements. Traversal is not linear and hence, search, insertion, ​and ...