CSC-325 · Semester V · Design and Analysis of Algorithms
intermediate30 minAvailable
Array ADTContiguous storage · O(1) index access
0
45
1
48
2
54
3
22
4
33
5
69
6
68
7
99
8
78
9
14
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.