Definition
Linear Data Structure
A data structure is called linear if its elements are arranged sequentially, one after another, forming a chain where each element (except potentially the first and the last) has a defined predecessor and successor.
Examples
Array
Definition
Link to originalArray
An array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. An array is stored such that the position of each element can be computed from its index tuple by a mathematical formula.
In most low-level implementations, an array is a contiguous block of memory.
Linked List
Definition
Link to originalSingly Linked List
A singly linked list is a linear data structure consisting of a sequence of nodes, where each node contains:
- Value: The data stored in the node.
- Next: A pointer or reference to the subsequent node in the sequence, or
nullif it is the terminal node (tail).Unlike an array, a linked list does not store elements in contiguous memory locations. Instead, nodes are linked using pointers, allowing for efficient insertions and deletions.