<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
,	O
growable	B-Data_Structure
array	I-Data_Structure
,	O
resizable	B-Data_Structure
array	I-Data_Structure
,	O
dynamic	B-Data_Structure
table	I-Data_Structure
,	O
mutable	B-Data_Structure
array	I-Data_Structure
,	O
or	O
array	B-Data_Structure
list	I-Data_Structure
is	O
a	O
random	B-General_Concept
access	I-General_Concept
,	O
variable-size	O
list	O
data	B-General_Concept
structure	I-General_Concept
that	O
allows	O
elements	O
to	O
be	O
added	O
or	O
removed	O
.	O
</s>
<s>
It	O
is	O
supplied	O
with	O
standard	B-Library
libraries	I-Library
in	O
many	O
modern	O
mainstream	O
programming	O
languages	O
.	O
</s>
<s>
Dynamic	B-Data_Structure
arrays	I-Data_Structure
overcome	O
a	O
limit	O
of	O
static	O
arrays	O
,	O
which	O
have	O
a	O
fixed	O
capacity	O
that	O
needs	O
to	O
be	O
specified	O
at	O
allocation	B-General_Concept
.	O
</s>
<s>
A	O
dynamic	B-Data_Structure
array	I-Data_Structure
is	O
not	O
the	O
same	O
thing	O
as	O
a	O
dynamically	B-General_Concept
allocated	I-General_Concept
array	O
or	O
variable-length	B-Data_Structure
array	I-Data_Structure
,	O
either	O
of	O
which	O
is	O
an	O
array	O
whose	O
size	O
is	O
fixed	O
when	O
the	O
array	O
is	O
allocated	O
,	O
although	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
may	O
use	O
such	O
a	O
fixed-size	O
array	O
as	O
a	O
back	O
end	O
.	O
</s>
<s>
A	O
simple	O
dynamic	B-Data_Structure
array	I-Data_Structure
can	O
be	O
constructed	O
by	O
allocating	O
an	O
array	O
of	O
fixed-size	O
,	O
typically	O
larger	O
than	O
the	O
number	O
of	O
elements	O
immediately	O
required	O
.	O
</s>
<s>
The	O
elements	O
of	O
the	O
dynamic	B-Data_Structure
array	I-Data_Structure
are	O
stored	O
contiguously	O
at	O
the	O
start	O
of	O
the	O
underlying	O
array	O
,	O
and	O
the	O
remaining	O
positions	O
towards	O
the	O
end	O
of	O
the	O
underlying	O
array	O
are	O
reserved	O
,	O
or	O
unused	O
.	O
</s>
<s>
Elements	O
can	O
be	O
added	O
at	O
the	O
end	O
of	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
in	O
constant	O
time	O
by	O
using	O
the	O
reserved	O
space	O
,	O
until	O
this	O
space	O
is	O
completely	O
consumed	O
.	O
</s>
<s>
Elements	O
can	O
be	O
removed	O
from	O
the	O
end	O
of	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
in	O
constant	O
time	O
,	O
as	O
no	O
resizing	O
is	O
required	O
.	O
</s>
<s>
The	O
number	O
of	O
elements	O
used	O
by	O
the	O
dynamic	B-Data_Structure
array	I-Data_Structure
contents	O
is	O
its	O
logical	O
size	O
or	O
size	O
,	O
while	O
the	O
size	O
of	O
the	O
underlying	O
array	O
is	O
called	O
the	O
dynamic	B-Data_Structure
array	I-Data_Structure
's	O
capacity	O
or	O
physical	O
size	O
,	O
which	O
is	O
the	O
maximum	O
possible	O
size	O
without	O
relocating	O
data	O
.	O
</s>
<s>
A	O
dynamic	B-Data_Structure
array	I-Data_Structure
might	O
be	O
preferred	O
if	O
:	O
</s>
<s>
To	O
avoid	O
incurring	O
the	O
cost	O
of	O
resizing	O
many	O
times	O
,	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
resize	O
by	O
a	O
large	O
amount	O
,	O
such	O
as	O
doubling	O
in	O
size	O
,	O
and	O
use	O
the	O
reserved	O
space	O
for	O
future	O
expansion	O
.	O
</s>
<s>
Expanding	O
the	O
array	O
by	O
any	O
constant	O
proportion	O
a	O
ensures	O
that	O
inserting	O
n	O
elements	O
takes	O
O(n )	O
time	O
overall	O
,	O
meaning	O
that	O
each	O
insertion	O
takes	O
amortized	B-General_Concept
constant	I-General_Concept
time	I-General_Concept
.	O
</s>
<s>
Many	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
also	O
deallocate	O
some	O
of	O
the	O
underlying	O
storage	O
if	O
its	O
size	O
drops	O
below	O
a	O
certain	O
threshold	O
,	O
such	O
as	O
30%	O
of	O
the	O
capacity	O
.	O
</s>
<s>
This	O
threshold	O
must	O
be	O
strictly	O
smaller	O
than	O
1/a	O
in	O
order	O
to	O
provide	O
hysteresis	O
(	O
provide	O
a	O
stable	O
band	O
to	O
avoid	O
repeatedly	O
growing	O
and	O
shrinking	O
)	O
and	O
support	O
mixed	O
sequences	O
of	O
insertions	O
and	O
removals	O
with	O
amortized	B-General_Concept
constant	O
cost	O
.	O
</s>
<s>
Dynamic	B-Data_Structure
arrays	I-Data_Structure
are	O
a	O
common	O
example	O
when	O
teaching	O
amortized	B-General_Concept
analysis	I-General_Concept
.	O
</s>
<s>
The	O
growth	O
factor	O
for	O
the	O
dynamic	B-Data_Structure
array	I-Data_Structure
depends	O
on	O
several	O
factors	O
including	O
a	O
space-time	O
trade-off	O
and	O
algorithms	O
used	O
in	O
the	O
memory	B-General_Concept
allocator	I-General_Concept
itself	O
.	O
</s>
<s>
If	O
memory	B-General_Concept
allocator	I-General_Concept
uses	O
a	O
first-fit	O
allocation	B-General_Concept
algorithm	O
,	O
then	O
growth	O
factor	O
values	O
such	O
as	O
a	O
=	O
2	O
can	O
cause	O
dynamic	B-Data_Structure
array	I-Data_Structure
expansion	O
to	O
run	O
out	O
of	O
memory	O
even	O
though	O
a	O
significant	O
amount	O
of	O
memory	O
may	O
still	O
be	O
available	O
.	O
</s>
<s>
The	O
dynamic	B-Data_Structure
array	I-Data_Structure
has	O
performance	O
similar	O
to	O
an	O
array	O
,	O
with	O
the	O
addition	O
of	O
new	O
operations	O
to	O
add	O
and	O
remove	O
elements	O
:	O
</s>
<s>
Dynamic	B-Data_Structure
arrays	I-Data_Structure
benefit	O
from	O
many	O
of	O
the	O
advantages	O
of	O
arrays	O
,	O
including	O
good	O
locality	B-General_Concept
of	I-General_Concept
reference	I-General_Concept
and	O
data	B-General_Concept
cache	I-General_Concept
utilization	O
,	O
compactness	O
(	O
low	O
memory	O
use	O
)	O
,	O
and	O
random	B-General_Concept
access	I-General_Concept
.	O
</s>
<s>
This	O
makes	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
an	O
attractive	O
tool	O
for	O
building	O
cache-friendly	O
data	B-General_Concept
structures	I-General_Concept
.	O
</s>
<s>
However	O
,	O
in	O
languages	O
like	O
Python	B-Language
or	O
Java	B-Language
that	O
enforce	O
reference	O
semantics	O
,	O
the	O
dynamic	B-Data_Structure
array	I-Data_Structure
generally	O
will	O
not	O
store	O
the	O
actual	O
data	O
,	O
but	O
rather	O
it	O
will	O
store	O
references	O
to	O
the	O
data	O
that	O
resides	O
in	O
other	O
areas	O
of	O
memory	O
.	O
</s>
<s>
In	O
this	O
case	O
,	O
accessing	O
items	O
in	O
the	O
array	O
sequentially	O
will	O
actually	O
involve	O
accessing	O
multiple	O
non-contiguous	O
areas	O
of	O
memory	O
,	O
so	O
the	O
many	O
advantages	O
of	O
the	O
cache-friendliness	O
of	O
this	O
data	B-General_Concept
structure	I-General_Concept
are	O
lost	O
.	O
</s>
<s>
Compared	O
to	O
linked	B-Data_Structure
lists	I-Data_Structure
,	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
have	O
faster	O
indexing	O
(	O
constant	O
time	O
versus	O
linear	O
time	O
)	O
and	O
typically	O
faster	O
iteration	O
due	O
to	O
improved	O
locality	B-General_Concept
of	I-General_Concept
reference	I-General_Concept
;	O
however	O
,	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
require	O
linear	O
time	O
to	O
insert	O
or	O
delete	O
at	O
an	O
arbitrary	O
location	O
,	O
since	O
all	O
following	O
elements	O
must	O
be	O
moved	O
,	O
while	O
linked	B-Data_Structure
lists	I-Data_Structure
can	O
do	O
this	O
in	O
constant	O
time	O
.	O
</s>
<s>
This	O
disadvantage	O
is	O
mitigated	O
by	O
the	O
gap	B-Data_Structure
buffer	I-Data_Structure
and	O
tiered	O
vector	O
variants	O
discussed	O
under	O
Variants	O
below	O
.	O
</s>
<s>
Also	O
,	O
in	O
a	O
highly	O
fragmented	B-Architecture
memory	O
region	O
,	O
it	O
may	O
be	O
expensive	O
or	O
impossible	O
to	O
find	O
contiguous	O
space	O
for	O
a	O
large	O
dynamic	B-Data_Structure
array	I-Data_Structure
,	O
whereas	O
linked	B-Data_Structure
lists	I-Data_Structure
do	O
not	O
require	O
the	O
whole	O
data	B-General_Concept
structure	I-General_Concept
to	O
be	O
stored	O
contiguously	O
.	O
</s>
<s>
A	O
balanced	B-Data_Structure
tree	I-Data_Structure
can	O
store	O
a	O
list	O
while	O
providing	O
all	O
operations	O
of	O
both	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
and	O
linked	B-Data_Structure
lists	I-Data_Structure
reasonably	O
efficiently	O
,	O
but	O
both	O
insertion	O
at	O
the	O
end	O
and	O
iteration	O
over	O
the	O
list	O
are	O
slower	O
than	O
for	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
,	O
in	O
theory	O
and	O
in	O
practice	O
,	O
due	O
to	O
non-contiguous	O
storage	O
and	O
tree	O
traversal/manipulation	O
overhead	O
.	O
</s>
<s>
Gap	B-Data_Structure
buffers	I-Data_Structure
are	O
similar	O
to	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
but	O
allow	O
efficient	O
insertion	O
and	O
deletion	O
operations	O
clustered	O
near	O
the	O
same	O
arbitrary	O
location	O
.	O
</s>
<s>
Some	O
deque	B-Application
implementations	O
use	O
array	O
deques	B-Application
,	O
which	O
allow	O
amortized	B-General_Concept
constant	I-General_Concept
time	I-General_Concept
insertion/removal	O
at	O
both	O
ends	O
,	O
instead	O
of	O
just	O
one	O
end	O
.	O
</s>
<s>
Goodrich	O
presented	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
algorithm	O
called	O
tiered	O
vectors	O
that	O
provides	O
O( 	O
n1/k	O
)	O
performance	O
for	O
insertions	O
and	O
deletions	O
from	O
anywhere	O
in	O
the	O
array	O
,	O
and	O
O(k )	O
get	O
and	O
set	O
,	O
where	O
k	O
≥	O
2	O
is	O
a	O
constant	O
parameter	O
.	O
</s>
<s>
Hashed	B-Data_Structure
array	I-Data_Structure
tree	I-Data_Structure
(	O
HAT	O
)	O
is	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
algorithm	O
published	O
by	O
Sitarski	O
in	O
1996	O
.	O
</s>
<s>
Hashed	B-Data_Structure
array	I-Data_Structure
tree	I-Data_Structure
wastes	O
order	O
n1/2	O
amount	O
of	O
storage	O
space	O
,	O
where	O
n	O
is	O
the	O
number	O
of	O
elements	O
in	O
the	O
array	O
.	O
</s>
<s>
The	O
algorithm	O
has	O
O(1 )	O
amortized	B-General_Concept
performance	O
when	O
appending	O
a	O
series	O
of	O
objects	O
to	O
the	O
end	O
of	O
a	O
hashed	B-Data_Structure
array	I-Data_Structure
tree	I-Data_Structure
.	O
</s>
<s>
describe	O
a	O
tiered	O
dynamic	B-Data_Structure
array	I-Data_Structure
data	B-General_Concept
structure	I-General_Concept
,	O
which	O
wastes	O
only	O
n1/2	O
space	O
for	O
n	O
elements	O
at	O
any	O
point	O
in	O
time	O
,	O
and	O
they	O
prove	O
a	O
lower	O
bound	O
showing	O
that	O
any	O
dynamic	B-Data_Structure
array	I-Data_Structure
must	O
waste	O
this	O
much	O
space	O
if	O
the	O
operations	O
are	O
to	O
remain	O
amortized	B-General_Concept
constant	I-General_Concept
time	I-General_Concept
.	O
</s>
<s>
Additionally	O
,	O
they	O
present	O
a	O
variant	O
where	O
growing	O
and	O
shrinking	O
the	O
buffer	O
has	O
not	O
only	O
amortized	B-General_Concept
but	O
worst-case	O
constant	O
time	O
.	O
</s>
<s>
Bagwell	O
(	O
2002	O
)	O
presented	O
the	O
VList	O
algorithm	O
,	O
which	O
can	O
be	O
adapted	O
to	O
implement	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
.	O
</s>
<s>
Naïve	O
resizable	B-Data_Structure
arrays	I-Data_Structure
--	O
also	O
called	O
"	O
the	O
worst	O
implementation	O
"	O
of	O
resizable	B-Data_Structure
arrays	I-Data_Structure
--	O
keep	O
the	O
allocated	O
size	O
of	O
the	O
array	O
exactly	O
big	O
enough	O
for	O
all	O
the	O
data	O
it	O
contains	O
,	O
perhaps	O
by	O
calling	O
realloc	B-Language
for	O
each	O
and	O
every	O
item	O
added	O
to	O
the	O
array	O
.	O
</s>
<s>
Naïve	O
resizable	B-Data_Structure
arrays	I-Data_Structure
are	O
the	O
simplest	O
way	O
of	O
implementing	O
a	O
resizeable	B-Data_Structure
array	I-Data_Structure
in	O
C	B-Language
.	O
They	O
do	O
n't	O
waste	O
any	O
memory	O
,	O
but	O
appending	O
to	O
the	O
end	O
of	O
the	O
array	O
always	O
takes	O
Θ(n )	O
time	O
.	O
</s>
<s>
Linearly	O
growing	O
arrays	O
pre-allocate	O
(	O
"	O
waste	O
"	O
)	O
Θ(1 )	O
space	O
every	O
time	O
they	O
re-size	O
the	O
array	O
,	O
making	O
them	O
many	O
times	O
faster	O
than	O
naïve	O
resizable	B-Data_Structure
arrays	I-Data_Structure
--	O
appending	O
to	O
the	O
end	O
of	O
the	O
array	O
still	O
takes	O
Θ(n )	O
time	O
but	O
with	O
a	O
much	O
smaller	O
constant	O
.	O
</s>
<s>
Naïve	O
resizable	B-Data_Structure
arrays	I-Data_Structure
and	O
linearly	O
growing	O
arrays	O
may	O
be	O
useful	O
when	O
a	O
space-constrained	O
application	O
needs	O
lots	O
of	O
small	O
resizable	B-Data_Structure
arrays	I-Data_Structure
;	O
</s>
<s>
they	O
are	O
also	O
commonly	O
used	O
as	O
an	O
educational	O
example	O
leading	O
to	O
exponentially	O
growing	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
.	O
</s>
<s>
C++'s	O
std::vector	O
and	O
Rust	B-Application
's	O
std::vec::Vec	O
are	O
implementations	O
of	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
,	O
as	O
are	O
the	O
ArrayList	B-Data_Structure
classes	O
supplied	O
with	O
the	O
Java	B-Language
API	O
and	O
the	O
.NET	B-Application
Framework	I-Application
.	O
</s>
<s>
The	O
generic	O
Listxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
class	O
supplied	O
with	O
version	O
2.0	O
of	O
the	O
.NET	B-Application
Framework	I-Application
is	O
also	O
implemented	O
with	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
.	O
</s>
<s>
Smalltalk	B-Application
's	O
OrderedCollection	O
is	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
with	O
dynamic	O
start	O
and	O
end-index	O
,	O
making	O
the	O
removal	O
of	O
the	O
first	O
element	O
also	O
O(1 )	O
.	O
</s>
<s>
Python	B-Language
's	O
list	O
datatype	O
implementation	O
is	O
a	O
dynamic	B-Data_Structure
array	I-Data_Structure
the	O
growth	O
pattern	O
of	O
which	O
is	O
:	O
0	O
,	O
4	O
,	O
8	O
,	O
16	O
,	O
24	O
,	O
32	O
,	O
40	O
,	O
52	O
,	O
64	O
,	O
76	O
,	O
...	O
</s>
<s>
Delphi	B-Language
and	O
D	B-Application
implement	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
at	O
the	O
language	O
's	O
core	O
.	O
</s>
<s>
Ada	B-Language
's	O
Ada.Containers.Vectors	O
generic	O
package	O
provides	O
dynamic	B-Data_Structure
array	I-Data_Structure
implementation	O
for	O
a	O
given	O
subtype	O
.	O
</s>
<s>
Many	O
scripting	O
languages	O
such	O
as	O
Perl	B-Language
and	O
Ruby	O
offer	O
dynamic	B-Data_Structure
arrays	I-Data_Structure
as	O
a	O
built-in	O
primitive	O
data	O
type	O
.	O
</s>
<s>
Several	O
cross-platform	O
frameworks	O
provide	O
dynamic	B-Data_Structure
array	I-Data_Structure
implementations	O
for	O
C	B-Language
,	O
including	O
CFArray	O
and	O
CFMutableArray	O
in	O
Core	B-Operating_System
Foundation	I-Operating_System
,	O
and	O
GArray	O
and	O
GPtrArray	O
in	O
GLib	B-Language
.	O
</s>
<s>
Common	B-Language
Lisp	I-Language
provides	O
a	O
rudimentary	O
support	O
for	O
resizable	O
vectors	O
by	O
allowing	O
to	O
configure	O
the	O
built-in	O
array	O
type	O
as	O
adjustable	O
and	O
the	O
location	O
of	O
insertion	O
by	O
the	O
fill-pointer	O
.	O
</s>
