tags:

views:

198

answers:

1

Hello,

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?

+2  A: 

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

http://en.wikipedia.org/wiki/Breadth-first_search

vartec
Thanks. I didn't know the technical term.
Burkhard