Length and capacity have different roles
A collection can change size even when its current backing array has a fixed number of slots. A dynamic array records occupied length separately from capacity. Length determines which indexes contain elements; capacity determines when more storage is needed.
For fixed-size elements or references, indexing locates a slot directly instead of traversing preceding items. Spare capacity consumes memory but lets a run of appends share storage that has already been allocated.
References: [1]
Resizing and shrink thresholds
When storage fills, the structure allocates a larger array, copies existing elements, and adopts the replacement. Multiplicative growth limits cumulative copying, although a particular resize still costs time proportional to the number of stored elements.
Shrinking commonly uses a different threshold. The textbook stack doubles when full and halves when occupancy falls to roughly one quarter. Separating these thresholds avoids immediately reversing a resize after the next insertion or deletion.
Different updates have different costs
Starting empty with suitable doubling, repeated appends have constant amortized cost. Inserting in the middle still requires shifting later elements to make room, and deleting there can require shifting them back to close the gap.
Dynamic arrays consequently suit indexed access and many end-oriented workloads, without making every update cheap. Evaluation should distinguish logical operations, copied elements, spare storage, and whether occasional longer resizing operations are acceptable.
References: [1]