Science

PhysicsQ&A LibraryConsider strings x and text, of length m and n, respectively, from an alphabet A consisting of d characters. (a) Modify the pseudocode of the naive string-matching algorithm to include the don’t care symbol. (b) Employ the assumptions of Problem 18 but also that x has exactly k don’t care symbols while text has none. Find the number of character-to-character comparisons made on average for otherwise random strings. (c) Show that in the limit of k = 0 your answer is closely related to that of Problem 18. (d) What is your answer in part (b) in the limit k = m?Question

Asked Mar 4, 2020

1 views

Consider strings x and text, of length m and n, respectively, from an alphabet A consisting of d characters.

(a) Modify the pseudocode of the naive string-matching algorithm to include the don’t care symbol.

(b) Employ the assumptions of Problem 18 but also that x has exactly k don’t care symbols while text has none. Find the number of character-to-character comparisons made on average for otherwise random strings.

(c) Show that in the limit of k = 0 your answer is closely related to that of Problem 18.

(d) What is your answer in part (b) in the limit k = m?

Expert Answer