Longest Common Subsequence by Dynamic Programming

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

Array ADT
0
25
1
16
2
51
3
63
4
31
5
14
6
65
7
45
8
16
9
28

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.