Question: 9. Suppose we want to search for a string inside a labeled rooted tree. Our input consists of a pattern string P[1..m] and a rooted

9. Suppose we want to search for a string inside a labeled rooted tree. Our input consists of a pattern string P[1..m] and a rooted text tree T with n nodes, each labeled with a single character. Nodes in T can have any number of children. Our goal is to either return a downward path in T whose labels match the string P, or report that there is no such path. The string SEARCH appears on a downward path in the tree. (a) Describe and analyze a variant of KARPRABIN that solves this problem in O(m +n) expected time
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
