Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2017/functional-programming-design-and-analysis-of-algorithms/8/d/solution

Enumerate all pairs of contiguous substrings, run the global algorithm on each pair, and take the largest score, also allowing the empty alignment of score zero. There are substrings of the first input and of the second. Each call costs at most for positive lengths, giving the requested upper bound . Substrings are contiguous; enumerating arbitrary subsequences would be a different search.

New to topics? Read the docs here!