Anonymous user
Array: Difference between revisions
explain arrays, really!
No edit summary |
(explain arrays, really!) |
||
Line 1:
An '''array''' is composite data type that stores multiple values all of the same declared type,
The array has a lower bound, and an upper bound, beyond which it is [[illegal]] to access the array. The lower bound is in many [[programming languages]] fixed to either 0 ([[C]] and relatives) or 1 ([[Pascal]] and relatives), but the upper bound is always programmable. The size of the array is the distance from the lower bound to the upper bound and one extra. In all regular programming languages, the size of the array can be determined by the programmer at [[compile time]] or after. In many modern programming languages the size of the array may be computed and allocated at run time. In some programming languages also the lower bound may be specified by the programmer.
All values between (and including) the lower and the upper bound of the array may legally be accessed during the program run.
==Computational metrics==
Access is O(1), appending is O(1), and insertion is O(n).
[[Category:Data Structures]]
|