[algogeeks] Re: trie display
@Prem I know the implementation of trie...But I have doubt that say I have struct trie * current.. and input = abc...The last character matched with head-CHILDREN[i]- letter will be 'c'... now current points to c next step- there will be 4 branches from 'c'...de,xyz,efgh,pqr... Now if write for(i=0;i26;i++) { if (current-CHILDREN[i]!=NULL current-CHILDREN[i]-islast==0) { cout current-CHILDREN[i]-letter; //d e current = current-CHILDREN[i];//head now points to 'e' } } The problem I am facing is how to take back current pointer to 'c' so that now I get efgh as output...and secondly how can I make sure that this time 'd' node is not selected again??? -- 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.
[algogeeks] Re: trie display
@Prem I know the implementation of trie...But I have doubt that say I have struct trie * current.. and input = abc...The last character matched with head-CHILDREN[i]- letter will be 'c'... now current points to c next step- there will be 4 branches from 'c'...de,xyz,efgh,pqr... Now if write for(i=0;i26;i++) { if (current-CHILDREN[i]!=NULL current-islast==0) { cout current-CHILDREN[i]-letter; //d e current = current-CHILDREN[i];//head now points to 'e' } } The problem I am facing is how to take back current pointer to 'c' so that now I get efgh as output...and secondly how can I make sure that this time 'd' node is not selected again??? -- 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.
[algogeeks] Re: trie display
It is not working..Even i tried to solve the problem using recursion but it didnt work code :- http://ideone.com/UhTTx -- 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] Re: trie display
You should do a dfs from the node which matches the prefix say abc. If its a word then print it. On Thu, Jun 28, 2012 at 3:55 PM, deepikaanand swinyanand...@gmail.comwrote: It is not working..Even i tried to solve the problem using recursion but it didnt work code :- http://ideone.com/UhTTx -- 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.