Documente Academic
Documente Profesional
Documente Cultură
Show that this ngerprint function has the following properties. i. M (x) is well dened for all x {0, 1} . ii. M (x) = M (y ) x = y . iii. For x {0, 1}n , the entries in M (x) are bounded by Fibonacci number Fn . By considering the matrices M (x) modulo a suitable prime p, show how you would perform ecient randomized pattern matching in 1-dimension. Explain how you would implement this as a real-time algorithm.
(b) Consider the two-dimensional version of the pattern matching problem. The text is an n n matrix X , and the pattern is an m m matrix Y . A pattern match occurs if Y appears as a (contiguous) sub-matrix of X . Get inspired from the randomized algorithm for part (a) above to design a randomized algorithm for this 2-dimensional pattern matching. The running time should be O(n2 + m2 ) and the error probability should be inverse polynomial in terms of n and m. The hint is: How to convert 2-dimensional pattern matching to 1-dimensional pattern matching. This hint will be expanded further on Friday (23 August). Till then keep pondering over it.