Content deleted Content added
rv: "a" before a word beginning with a vowel sound becomes "an" in english |
m →Uses: disambig stack |
||
Line 15:
== Uses ==
Although useful in their own right, arrays also form the basis for several more complex data structures, such as [[heap]]s, [[hash table]]s, and [[VList]]s, and can be used to represent [[string]]s, [[Stack (computing)|stack]]s and [[queue]]s. They also play a more minor role in many other data structures. All of these applications benefit from the compactness and locality of arrays.
One of the disadvantages of an array is that it has a single fixed size, and although its size can be altered in many environments, this is an expensive operation. ''Growable arrays'' or ''dynamic arrays'' are arrays which automatically perform this resizing as late as possible, when the programmer attempts to add an element to the end of the array and there is no more space. To average the high cost of resizing over a long period of time (we say it is an [[amortized analysis|amortized cost]]), they expand by a large amount, and when the programmer attempts to expand the array again, it just uses more of this reserved space.
|