Big O for Arrays
Arrays are random access, which means that access to any element
has the same cost.
- a[i] is O(1).
- Allocating a new array (not initializing the contents)
could be essentially O(1). However, since Java is type-safe,
the new array must be initialized for its contents type,
so creation of a new size n array costs O(n).
- Arrays are rigid: they cannot be expanded. One must either:
- Get a new larger array and copy the old contents into it, O(n)
- Make the array over-sized, wasting some space.
Contents   
Page-10   
Prev   
Next   
Page+10   
Index