They could have used a binary tree The other steps of the argument are more

They could have used a binary tree the other steps of

This preview shows page 2 - 4 out of 9 pages.

3. (20 level)Searching for VirusesSherlock Holmes is trying to write a computer antivirus program. He starts by modeling his problem. Hethinks of computer RAM as being a binary strings2of lengthm. He thinks of a virus as being a binary strings1of lengthn<m. His program needs to find all occurrences ofs1ins2in order to get rid of the virus. Evenworse, though, these viruses are still damaging if they differ slightly froms1. So he wants to find all copiesofs1ins2that differ in at mostklocations for arbitrarykn.a) Give aO(mn)time algorithm for this problem. CS 170, Fall 2016, HW 2 2
Image of page 2
b) Give aO(mlogm)time algorithm for anyk.(Hint: find a way to use FFT.)For this question we will not require a 4-part solution. Instead, please give us a clear description of thealgorithm and an analysis of the running time. Give Pseudocode if you feel it will enhance your solution,but it is not required.
Image of page 3
Image of page 4

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture