think in term of following input case :-

best
test
testbest

than i guess you will come to knw why i got confused at first place.
*madammadam*
*testtesttest *
ignore this type of test case.

On Wed, May 23, 2012 at 12:40 AM, Prem Krishna Chettri
<hprem...@gmail.com>wrote:

> Thank you to understanding Me..
>
>   Well For Trie.. I don't hv to say much more to say except the basic need
> which says "Collect Common Prefix" . If it didnt ring the bell.. than Hv a
> look at strings MADAM and MADAMIAMADAM stored in your TRIE .. Just draw a
> pictorial representation.
>
>
>
> On Wed, May 23, 2012 at 12:20 AM, atul anand <atul.87fri...@gmail.com>wrote:
>
>> yes ,longest word can be found while inserting each word it the TRIE.
>>
>>  *By tracking Second and First Longest word found** -- *confused me
>> ...what you were trying to say.
>> tracking can be done but become little difficult if input is something
>> like this :-
>>
>> best
>> bestest
>> test
>> testbest
>> testbesttest
>>
>> btw TRIE containing only distinct word i.e words not made up of sub words
>> would be enough to solve the problem
>>
>> On Tue, May 22, 2012 at 11:40 PM, Prem Krishna Chettri <
>> hprem...@gmail.com> wrote:
>>
>>> Haha,, Do I hv to respond Here.. Anyways Guys And Specially Mr.Atul.
>>> Here is the Long way to Make you understand..
>>>
>>> Yes 2 ptr is Alwayz Enuf now Why??
>>>
>>>          Yes Words can be a assembly of words.. Like say you sample
>>> "testtesttest..n time".. So Lets go back to Simple recursion.. Tell me how
>>> U calculate recursive Factorial (n) ?? similarly to get testtest...n there
>>> must be one string called testtest...(n-1) and the other test right !!! So
>>> 2 ptr is alwayz enuf to resolve this.
>>>
>>>   Now as we all know the smart way to update these valuable pointers are
>>> keep looking for possible next level words.. So I've put.(*Updating
>>> Otherwise Accordingly)*
>>>
>>> For your second condescending question.
>>>
>>>                   It is well known if U remember DWAG/TRIE that they
>>> have nodes which *MAY *contains Alphabets.. as we move down using
>>> branches alwayz. so. if U are Considering Node as Alphabets (Narrow way of
>>> thinking) than yes, but I would like to be more general and so will like to
>>> put as N=Number of Nodes to be visited.
>>>
>>> BR,
>>> Prem
>>>
>>>
>>> On Tue, May 22, 2012 at 10:41 PM, atul anand <atul.87fri...@gmail.com>wrote:
>>>
>>>> @krishna : tracking just second and first longest word would be enough??
>>>>
>>>> what if input has word which is made by repeating small word again and
>>>> again
>>>> test
>>>> tester
>>>> testertest
>>>> testing
>>>> testingtester
>>>> testtesttesttesttest  // added word
>>>>
>>>> and by saying O(n) .. n= total number of alphabets in the file rite??
>>>>
>>>> On Tue, May 22, 2012 at 7:17 PM, Prem Krishna Chettri <
>>>> hprem...@gmail.com> wrote:
>>>>
>>>>> Yea this is a Straight Cut Trie Question No Doubt.. Perhaps DWAG may
>>>>> be taken into consideration..
>>>>>
>>>>> T(O)=O(n) can be done easily.. ( By tracking Second and First Longest
>>>>> word found soFar and updating otherwise accordingly)
>>>>>
>>>>> Can someone do it better?
>>>>>
>>>>>
>>>>> On Tue, May 22, 2012 at 6:15 PM, Ashish Goel <ashg...@gmail.com>wrote:
>>>>>
>>>>>> write a program to find the longest word made of other words. For
>>>>>> instance, If my file has the following words (sorted):
>>>>>> test
>>>>>> tester
>>>>>> testertest
>>>>>> testing
>>>>>> testingtester
>>>>>>
>>>>>> The longest word should be testingtester. Trie is the solution, what
>>>>>> is the best Order possible?
>>>>>> Best Regards
>>>>>> Ashish Goel
>>>>>> "Think positive and find fuel in failure"
>>>>>> +919985813081
>>>>>> +919966006652
>>>>>>
>>>>>> --
>>>>>> 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
>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>
>>>>>
>>>>>  --
>>>>> 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
>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>> For more options, visit this group at
>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>
>>>>
>>>>  --
>>>> 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
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> 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
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to