Educational Objectives: After completing this assignment, the student should be able to accomplish the following:
Operational Objectives: Design and implement the class template RabinKarp< Radix, Prime > that acts as a function object on input strings, returning the location of a first match or the length of the input string when no match is found.
Deliverables: Files:
rk.h # definition & implementation of template< size_t Radix, size_t Prime > class RabinKarp log.txt # project log and commentary
The official development | testing | assessment environment is clang++ -std=c++11 on the linprog machines. Code should compile without error or warning.
File log.txt should explain how the software was developed, how it was tested, and how it is expected to be operated.
Copy the files LIB/scripts/submit.sh and LIB/proj6/deliverables.RK into your project directory. (submit.sh may be omitted if the submit system is executable in your /.bin.) Submit the project by executing the script: submit.sh deliverables.RK
Warning: Submit scripts do not work on the program and linprog servers. Use shell.cs.fsu.edu to submit projects. If you do not receive the second confirmation with the contents of your project, there has been a malfunction.
Class RabinKarp < size_t R , size_t P > should conform to the outline given in Strings 2.
Test Harness. The class should function correctly using the supplied test harness frk.cpp.
Monte Carlo Rule. The pattern is matched with high probability. The runtime is guaranteed O(n + k), where n is incoming string length and k is the pattern length.
Las Vegas Rule. The pattern match is guaranteed. The runtime is O(n + k) with high probability, where n is incoming string length and k is the pattern length. Worst case runtime is Ω(n×k).
Probability. There should be a method long double Probability() const that returns the probability estimate of success under either rule.
Generalizations. Three directions for generalization should be discussed in log.txt.
See Strings 2 for discussion and ideas on details.
See the executables fkmp.x and frk.x in LIB/area51.
To get matching Dump results, display probability as fixed with 12 decimal places.