first search for node where "abc" ends i.e say func Search() will return
node whose
node->ch='c';(last character of input abc)
then pass this node to following algo :-
this is just a code sketch....so you can add boundary conditions to
it..(if i miss it)
print(node *root,int j)
{
if(!root)
return;
if(root->end)
{
output[j]=root->data;
output[j+1]='\0';
printf("\n%s\n",output);
}
for(i=0;i<26;i++)
{
if(root->childre[i])
{
if(root[i]->data==('a'+i) )
{
output[ j ] = root->data
}
print(root->child[i],j+1)
}
else
{
print(root->child[i], j );
}
}
}
On Thu, Jun 28, 2012 at 12:23 PM, deepikaanand <[email protected]>wrote:
> If there is a trie of following strings(say URLs)
> "abcde","abcegh","abcpqr","abcxyz","xyz"
>
> if input = abc
> then output should be = de,egh,pqr,xyz
>
> How can I code for this ???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.