Question
Write a program that breaks up a string of words with no spaces into a string with the appropriate spaces.
Follow the following process:
- Clarify the problem
- Refine the solution
- Code it
- Last words
Clarify the problem
- Consider a general case, like “fastman”
- Disambiguate expected result
- State the key assumptions
- clarify function signature
2 words? null input? where is the words from? We might use a dictionary.
Refine the solution
- what if the dictionary cannot fit in RAM
- how would you print the most likely of multiple choices
- what if the words are not spelled correctly?
- Testing
Code it
Write code now, skip.
Last words
Talk naive solution, then come up with a reasonably better one.
Time/Space tradeoff. (like pre-processing or something)
For very big/small input.
White-board practise is important!