Re: [algogeeks] Question from Google interview

2011-08-19 Thread arun kumar
Build a Trie... Recursive search on trie This ll give you all possible interpretation of the given key On 8/18/11, Navneet Gupta navneetn...@gmail.com wrote: Given a string containing multiple words such that spaces between words is missing. Also, you have a dictionary containing valid

Re: [algogeeks] Question from Google interview

2011-08-19 Thread priya ramesh
Hash in the dictionary for the first letter in the string. Check if any word in the dictionary beginning with this letter is a substring of the given string. If yes and if the substring forms the initial part of the string, tokenize it. Continue the process with the next word. -- You received

[algogeeks] Question from Google interview

2011-08-18 Thread Navneet Gupta
Given a string containing multiple words such that spaces between words is missing. Also, you have a dictionary containing valid words. Ex. Thatwouldbefantastic Output a string with proper spaces inserted. Output - That would be fantastic The case of words like bandwidth present can be

Re: [algogeeks] Question from Google interview

2011-08-18 Thread aditya kumar
not sure abt the algo but we can think in terms of tokeninzing . ie go for greedy method . greedy looks for maximum match . extract the token and match with the dictionary word . if match found then add the additional space else look for next token . On Thu, Aug 18, 2011 at 9:10 PM, Navneet Gupta