hw6 - CS161 Homework 6 Due Wednesday August 12 before...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CS161 - Homework 6 Due: Wednesday August 12, before class (9am) No late submissions 1. (8 points) In class, we mentioned including the “swap” operation in our edit distance function. The swap operation only swaps adjacent characters. For example, Edit (‘recieve’,‘receive’) = 1 if we allow the swap operation (swapping ‘i’ and ‘e’), but we could not swap ‘r’ and ‘e’. (a) Write the recursive subproblem relation for swap (e.g. for insert, it was Edit ( X,Y ) = 1 + Edit ( X 1 ...n ,Y 1 ...m - 1 ) and for delete it was Edit ( X,Y ) = 1 + Edit ( X 1 ...n - 1 ,Y 1 ...m )). (b) Describe how to change the Edit procedure covered in class to include the swap operation. You may either edit the pseudocode directly or describe what needs to be added/changed. 2. (10 points) String matching algorithms (a) (5 points) In class, we discussed three different string matching algorithms: naive, FSA based and Rabin-Karp. For each of these three algorithms, list two things, 1) describe a situation where the algorithm would perform better than the other two algorithms 2) describe an application where this situation would occur.
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern