You’re given a string of n characters s[1,…,n] whichyou believe to be a corrupted text document in which allpunctuation has vanished(soitlookssomethinglikethis). You wish toreconstruct the document using a dictionary, which is available inthe form of a Boolean function dict(.): for any stringw,
dict(w)= True if w is a valid word, Falseotherwise
(a) Give a dynamic programming algorithm that determineswhether the string s[.] can be reconstituted as a sequence of validwords. The running time should be at mostO(n2) assuming calls to dicttakes unit time.
(b) In the event that the string is valid, make youralgorithm output corresponding sequence of words.
Expert AnswerÂ
A
PayPal Gateway not configured
PayPal Gateway not configured