Linked list

Also known as: Singly linked list, Doubly linked list

A linked list stores elements in nodes with pointers to neighbors. Singly linked lists have a next; doubly linked lists also have prev. Access by index is $O(n)$; insert/delete at a known node is $O(1)$ pointer updates.

Good for stacks, queues, and intrusive lists in systems code. Poor spatial locality versus arrays. Binary search does not apply.

In high-level application code, a dynamic array is usually faster unless you truly need middle splices without shifting.

← Back to CS Glossary