Tutorial :How to traverse a trie longitudinally?


i have a Trie and several functions modifiing it.

typedef struct node *pnode;    typedef struct node  {      int element;      pnode next;//same level, other element      pnode subtree;//next level  } node;  

Now, in order to debug and/or test my functions, I need to print out the tries.

I tried it recursively, but I cannot get the first level, than the second level...

What's a good way to do it?


Instead of using stack (or emulating it with recurrence), you have to use queue.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »