- To apply pattern matching algorithm concepts.
- To write the program to represent a Karp-Rabin method
Problem
You are to implement the Karp-Rabin string search algorithm. Your program will prompt for the name of an input file and then read and process the data contained in this file.
The file contains two sequences of characters. The first is the target sequence, T, the second is the search sequence S. Read both strings and find all occurrences of sequence S in sequence T using the KarpRabin algorithm.
For each matched sequence, print the location of the first matched character in T.
For example, if the test data looked like this:
ACGTACGTACCAGTA AC
The output should be:
0, 4, 8
Notes:
- The sequence T is no longer than 500 characters
- The sequence S is no longer than 10 characters
Reviews
There are no reviews yet.