Longest Common Subsequence by Dynamic Programming

CSC-325 · Semester V · Design and Analysis of Algorithms

Array ADT
0
31
1
99
2
38
3
95
4
59
5
77
6
20
7
60
8
53
9
43

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.