CSC-325 · Semester V · Design and Analysis of Algorithms
intermediate30 minAvailable
Array ADTContiguous storage · O(1) index access
0
41
1
95
2
49
3
18
4
93
5
10
6
90
7
10
8
17
9
78
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.