This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 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 RabinKarp. For each of these three algorithms, list two things, 1) describe a situation where the...
View
Full
Document
This document was uploaded on 05/25/2011.
 Summer '09
 Algorithms

Click to edit the document details