Apply DFS in the trie
--
Akshat Sapra
Under Graduation(B.Tech)
IIIT-Allahabad(Amethi Campus)
*--*
sapraaks...@gmail.com
akshatsapr...@gmail.com
rit20009008@ iiita.ac.in
--
You received this message because you are subscribed to the Google Groups
"Algorithm
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 sketchso you can add boundary conditions to
it..(if i miss it)
print(node *root,int j)
{
if(!root)
re
do similar to inorder traversal after reaching at node 'c'..you will get
the desired output and in dictionary order .
On Thu, Jun 28, 2012 at 12:23 PM, deepikaanand wrote:
> If there is a trie of following strings(say URLs)
> "abcde","abcegh","abcpqr","abcxyz","xyz"
>
> if input = abc
> then outp
tire will always contain the link to all its children.This problem is just
printing out the children once the key is fully reached.
ie., search for abc in trie print all the children of c node.
Raghavan
From: deepikaanand
To: Algorithm Geeks
Sent: Thursda
Well it Seems like problem is the DS here.
if U have the DS of trie as
struct trie {
char letter;// Not being general
boolean islast;
int startindex;
struct trie *next;
};
I am sure you w