Arrays and Dynamic Arrays
Contiguous memory with O(1) indexing; dynamic arrays grow by reallocating.
Beginner
An array stores elements next to each other, so element is at base + i * size — instant access. Inserting or deleting in the middle shifts elements: .
A dynamic array (Python list, C++ vector, Java ArrayList) doubles its capacity when full, so appending is amortised.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.