문제

I have a problem with an exercie. I hope you can help me.

We want to detect whether a binary pattern P of length m occurs in a binary text T of length n where: m < n.

State an algorithm that runs in time O(n) where we assume that arithmetic operations on O(log2 n) bit numbers can be executed in constant time. The algorithm should accept with probability 1 whenever P is a substring of T and reject with probability at least 1 - 1/n otherwise.

We got a hint that we should use fingerprinting. Can someone help? Thanks!

도움이 되었습니까?

해결책

The KMP is a deterministic algorithm that does this in in linear time. But i am wondering too, if this could be done with a probabilistic algorithm.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top