trie or ternary tree and build stack for the string being entered, keep
distributed hashmap for head/tail queries like cricket, weather, finance
etc various domains etc..


Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Sat, Jun 30, 2012 at 12:05 PM, shady <sinv...@gmail.com> wrote:

> i am not sure if it is possible to change the length of an already
> declared array, so i think one might wanna use pointers instead. Allocate
> memory dynamically.
>
>
> On Thu, Jun 28, 2012 at 2:36 PM, deepikaanand <swinyanand...@gmail.com>wrote:
>
>> //Taken from careercup.com
>>
>> Design the autocomplete feature (ex:Google Suggest)
>>
>> I assumed {"abcde","abcegh","abcpqr","abcxyz","xyz" ,"abcmno"} URLs
>> and stored them in trie...Such if the user enters abc ...the o/p will
>> be
>>
>> abc is a prefix in 5 number of cases
>>  d e
>>  e g h
>>  m n o
>>  p q r
>>  x y z
>>
>>
>> Now say if I add more strings of the form abcdpqr,"abcdprst"..How can
>> I modify this code such that now thw o/p is
>>
>>  d e
>>  e g h
>>  m n o
>>  p q r
>>  x y z
>>  d p q r
>>  d p r s t
>>
>> code in c :-
>> http://ideone.com/rBvQb
>>
>> --
>> 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