← Back to the arrays page
Static & Dynamic Arrays
The contiguous block itself. Static arrays fix capacity at creation; dynamic arrays (JS arrays, Python lists, Go slices) resize by doubling.
What to know
- Doubling growth gives amortized O(1) append — each element is copied O(1) times on average.
- Indexing is pointer arithmetic: base + index × element size.
- Contiguity is why arrays beat linked structures in practice: cache lines and prefetching.
In the wild: Every language’s default list type; the backing store of hash tables, heaps, and stacks.
Algorithms to reach for
Kadane’s algorithm
O(n)Maximum subarray sum in one pass
Dutch national flag
O(n)Three-way partition (sort colors) in place
In-place reversal / rotation
O(n)Rotate array by k using triple reverse
Practice problems — with full guides
Each problem has its own page: progressive hints, how to approach it, and the full solution.