CSC-325 · Semester V · Design and Analysis of Algorithms
intermediate30 minAvailable
Array ADTContiguous storage · O(1) index access
0
64
1
63
2
68
3
34
4
34
5
81
6
43
7
77
8
42
9
54
Length
10
Comparisons
0
Writes
0
Index access is O(1) — that is why arrays beat lists for random reads. But inserting at the front shifts every element, costing O(n). Try inserting at index 0.