Examveda

If n is the length of text(T) and m is the length of the pattern(P) identify the correct pre-processing algorithm. (where q is a suitable modulus to reduce the complexity)
p=0; t0=0;

A.

for i=1 to n
do t0=(dt0 + P[i])mod q 
p=(dp+T[i])mod q

B.

for i=1 to n
do p=(dp + P[i])mod q 
t0=(dt0+T[i])mod q

C.

for i=1 to m
do t0=(dp + P[i])mod q 
p=(dt0+T[i])mod q

D.

for i=1 to m
do p=(dp + P[i])mod q 
t0=(dt0+T[i])mod q

Answer: Option D


This Question Belongs to Data Structure >> String Matching

Join The Discussion

Related Questions on String Matching