DAT158 Algoritme Oblig1

Problem 2b (Boyer-Moore)

The theory says that experiments shows that on English text, the average number of comparisons done per text character Is approximately 0.24 for a five character pattern string. Implement the algorithm and run it on a Norwegian (or another language) text and compare the results.

Problem 3 (Knuth-Morris-Pratt)

Implement the algorithm

Problem 9

a) Implement a recursive version of the longest common subsequence problem.

b) Implement the dynamic version of the longest common subsequence problem.

c) Experiment with strings of different length. At some point the recursive version will start using “a lot of time” while the dynamic version is still fast. Approximately, at what point does this happen?