An American spy is deep undercover in the hostile country of Phonemia. In order not to waste
Question:
An American spy is deep undercover in the hostile country of Phonemia. In order not to waste scarce resources, any time he wants to send a message back home, he removes all the punctuation from his message and converts all the letters to uppercase. So, for example, to send the message,
“Abort the plan! Meet at the Dark Cabin.”
he would transmit
ABORTTHEPLANMEETATTHEDARKCABIN
Given such a string, S, of n uppercase letters, describe an efficient way of breaking it into a sequence of valid English words. You may assume that you have a function, valid(s), which can take a character string, s, and return true if and only if s is a valid English word. What is the running time of your algorithm, assuming each call to the function, valid, runs in O(1) time?
Step by Step Answer:
Algorithm Design And Applications
ISBN: 9781118335918
1st Edition
Authors: Michael T. Goodrich, Roberto Tamassia