Question: ( c ) The following recursive algorithm uses a slightly different idea. Its correctness relies on the fact that a string w 1 w 2

(c) The following recursive algorithm uses a slightly different idea. Its correctness relies on the
fact that a string w1w2dotswninL** if and only if there exists an index iin{0,dots,n-1} such
that w1w2dotswiinL** and wi+1dotswninL. Explain why S2 does not run in polynomial time.
(d) The main issue with the recursive algorithm in part (c) is that it for each prefix w1w2dotswi of
w, it keeps repeating the work of checking whether that prefix is in L**. Wouldn't it be great
if for each i, you only had to check whether w1w2dotswi is in L** once?
It turns out you can, and this forms the basis of an actual polynomial time algorithm. Think
of filling out an array T[0,1,dots,n] where each cell T[i] contains the answer to the question,
"is w1w2dotswiinL**?" Design an algorithm S3 that systematically fills in this array and uses
it to determine whether winL**. Briefly explain why your algorithm runs in polynomial time,
and how it allows you to conclude that P is closed under the star operation.
( c ) The following recursive algorithm uses a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!