Linked list

Applies to: general

A linked list stores elements in nodes, each pointing to the next. Inserting/removing at a known position is O(1), but indexing is O(n) (no contiguous memory). It trades the array's fast indexing for flexible insertion.

[10|*]-->[20|*]-->[30|null]   each node holds a value + a link

See also: array, stack, queue