2
|
|
→ |
|
|
|
→ |
|
|
|
→ |
|
Move the smaller first value of the two arrays to the next slot in the merged array. Repeat.
2 sorted arrays of size p and q can be merged in $O(p+q)$ time to form a sorted array of size p+q
5
The tables used by the dynamic programming method
7
8
Now suppose that we made two tours
11
We want to calculate the longest path from (0,0) to (n,m) that passes through (i,m/2) where i ranges from 0 to n and represents the i-th row
Define Score(i) as the score of the path from (0,0) to (n,m) that passes through vertex (i, m/2)
12
Define (mid,m/2) as the vertex where the best score crosses the middle column.
13
17
18
20
22
How does a block relate to a correct alignment?
The alignment passes through O(n/t) total blocks
Paths enter from the top or left and exit from the right or bottom
If we know the best score at the boundaries, perhaps we can peice together a solution as we did before.
24
25