Re: [algogeeks] trie display

2012-07-01 Thread Akshat Sapra
Apply DFS in the trie

-- 


Akshat Sapra
Under Graduation(B.Tech)
IIIT-Allahabad(Amethi Campus)
*--*
sapraaks...@gmail.com
akshatsapr...@gmail.com
rit20009008@ rit20009...@gmail.comiiita.ac.in

-- 
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.



Re: [algogeeks] trie display

2012-06-29 Thread atul anand
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)
return;

if(root-end)
{
output[j]=root-data;
output[j+1]='\0';
printf(\n%s\n,output);
}
  for(i=0;i26;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 swinyanand...@gmail.comwrote:

 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 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.



Re: [algogeeks] trie display

2012-06-28 Thread Prem Krishna Chettri
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 won't have any issue. coz now what u have to do is to start
searching the code which matches the startindex with the given input and
search till the islast is not equal to true. Well thats how trie works if
ppls are unaware..

BR,
Prem

On Thu, Jun 28, 2012 at 12:23 PM, deepikaanand swinyanand...@gmail.comwrote:

 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 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.



Re: [algogeeks] trie display

2012-06-28 Thread raghavan M
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 swinyanand...@gmail.com
To: Algorithm Geeks algogeeks@googlegroups.com 
Sent: Thursday, 28 June 2012 12:23 PM
Subject: [algogeeks] trie display
 
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 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.



Re: [algogeeks] trie display

2012-06-28 Thread atul anand
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 swinyanand...@gmail.comwrote:

 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 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.