ECE 198
Homework 7
Due Early Week 8, On-Time Week 9
Last modified: 6/3/2002
- Always write the time-complexity (in Big Oh notation) in a comment next to every method or function you write in this class.
- Use the test input and timers from homework 1.
- Note submitting any program that you did not write yourself is plagiarism - a very serious form of cheating.
Anyone caught submitting a homework solution they did not author themselves will be prosecuted to the fullest extend of UCI law. Just as a reminder, please re-read my cheating policy.
Cheating policy.
- Note you may use the algorithms from the text, from my notes, or from the web for this homework, but you must fix them so they work in this context.
- (25 points) Implement Naive brute-force pattern matching
- (25 points) Implement BoyerMoore.
- (25 points) Implement Knuth-Morris-Pratt.
- (25 points) Write a driver program that allows the user to test your class implementation. Again use the PCTimer class to measure the search time for each of these pattern search algorithms:
- fill an array with the text from random.txt (note there are 408969 characters in this file, so make sure your array is at least that large).
- t1.start(), find (and count) all occurances of "able", t1.end()
- print out (to a user specified file) the times required to do this using each of the three pattern matching algorithms you implement above.
- Again, be sure your main program takes arguments from the command line for input file name and output file name.
- What to submit:
- Show your TA that your program works as described above.
- Submit (and save) your program for future comparison with the others.