Arrays and strings
Contiguous storage: indexing, shifting, growing arrays, matrices and strings.
- Arrays: indexing, traversal, insertion and deletion costs Arrays give instant access by index, but inserting or deleting in the middle shifts every later element. Watch elements shift one by one.
- Dynamic arrays: capacity, growth, amortized append A dynamic array grows by copying into a bigger block when it fills. Doubling the capacity keeps appends O(1) on average.