A linear data structure stores data in a linear sequence.The data is organized in a single,
contiguous
sequence.
Arrays, stacks, queues and linked lists are all
examples
of linear data structures.
Arrays are
fast
for accessing individual elements, but inflexible when it comes to inserting and deleting elements.
Arrays
Stacks are a linear data structure that follows the Last In, First Out (
LIFO
) principle.
Stacks
Queues are a linear data structure that follows the First In, First Out (
FIFO
) principle.
Queues
They are more
flexible
than arrays when it comes to inserting and deleting elements, but slower for accessing individual elements.
Linked lists
In a linear data structure, the elements are accessed
sequentially
, starting from one end to the other.
Linear data structures are efficient for accessing individual elements, but
inefficient
for inserting and deleting elements
Various types of data structure