Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python def main(): # mini_test() assn = Assignment4 sizes = [100, 1000, 10000, 100000] algs = [native_search, brute_force, rabin_karp, knuth_morris_pratt, boyer_moore] trials = 10 for
python
def main(): # mini_test() assn = "Assignment4" sizes = [100, 1000, 10000, 100000] algs = [native_search, brute_force, rabin_karp, knuth_morris_pratt, boyer_moore] trials = 10 for pattern_length in [4, 8, 12, 16]: title = "Runtime of String Search Algorithms" + str(pattern_length) dict_algs = run_algs(algs, sizes, trials) Assignment2.print_times(dict_algs) Assignment2.plot_times(dict_algs, sizes, trials, algs, title, assn + '.png')[5] Create a loop to run the previous code several times for different length patterns (instead of hard-coded at 5): for pattern_length in [4,8,12,16] : * do run_algs for that pattern length * print the times for that pattern length * make the graph for pattern length You should submit one console output with runs for all pattern lengths, but only one graph for pattern length 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started