2c03-review - 00099

2c03-review - 00099 - by procedure find1(i.e the...

This preview shows page 1. Sign up to view the full content.

1 CS2MD3. Sample solutions to the assignment 2. Total of this assignment is 122pts. Each assignment is worth 5%. If you think your solution has been marked wrongly, write a short memo stating where marking in wrong and what you think is right, and resubmit to me during class, office hours, or just slip under the door to my office. 1[20]. a[5]. Compute the failure function f for pat =abaabaabab 1 2 3 4 5 6 7 8 9 10 a b a a b a a b a b f(I) 0 0 1 1 2 3 4 5 6 2 b[15]. Suppose that x = abbbabbaabbabaababaabaabaababbabbbabba and we want to know if text x contains pattern pat. How many character comparisons are required
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: by procedure find1 (i.e. the straightforward algorithm)? How many character comparisons are required by procedure find2 (i.e. the KMP algorithm)? Using find 1 a b b b a b b a a b b a b a a b a b a a b a a b a a b a b b a b b b a b b a # pass1 a b a 3 pass2 a 1 pass3 a 1 pass4 a 1 pass5 a b a 3 pass6 a 1 pass7 a 1 pass8 a b 2 pass9 a b a 3 pass10 a 1 pass11 a 1 pass12 a b a a b a a 7 pass13 a 1 pass14 a b 2 pass15 a b a a 4 pass16 a 1 pass17 a b a a b a a b a b 10 pass18 a 1 pass19 a b 2 pass20 a b a a b a a b a b 10 56...
View Full Document

• Spring '03
• janicki
• 1997 in film, Knuth–Morris–Pratt algorithm, CS2MD3. Sample solutions, character comparisons, pass14 ab pass15

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern