A list
does not support random access, and element of list
is stored seperately in memory. There is no need to reallocate its elements, and thus no need to preallocate memory. So the "capacity
" of a list
is the same with its size
.
An array
has a fixed size, there is also no need to reallocate its elements, and thus no need to preallocate memory. So the "capacity
" of an array
is the same with its size
too.