You could do this too...
1. Sort the words based on length. Max Time: O(nlogn)
2. Now, Create a tree similar to a state transition diagram. For each word
in the tree, store their start and end pointers.
3. If a word comprises of another word, then the main word would only store
start and end point
when talking assimpotically it doesn't really matter what base is, as
log_a(x) = log_b(x) * 1/log_b(a) and 1/log_b(a) is constant
On Thu, May 15, 2008 at 1:52 PM, amitabh chauhan <[EMAIL PROTECTED]>
wrote:
> actually base do not matters base 2 and base 10 are constant multiple of
> each other so
You can solve this problem by the following technique:
Proc 1: Take any word W in the file
Find all strings S(k) which are formed by concatenating k words in the file
and is a prefix of W. [A word can repeat multiple times in different places]
As you can see, number of words in S(k) will certainly
Regular expressions ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROT
Well, he does say "other" words. "hippopotamuses" is not made up of
other words in the list.
It looks like a recursive procedure would do the trick. It might help
to sort the word list into order by length. Then beginning with the
longest word, find other words that match the beginning of the wor
This question aint clear
So, for example in above list hippopotamuses is also in the list of
word in the file.
So this word includes itself and is 14 characters.
where is a condition that concatenation is a must?
On May 20, 3:39 am, greg <[EMAIL PROTECTED]> wrote:
> Write a program that reads