Binary tree traversal - a complex case - Help! 
Author Message
 Binary tree traversal - a complex case - Help!

I have a little problem:

I have a binary tree and the traversal function

traverse(treenode *node, treenode *found[])

In my case, the treenode *node passed to traverse() is the  root.
treenode *found[] is an array of nodes, initially empty.

I use the traditional recursive function:

        Visit the node
        traverse(node->right); }

In my case it is:

traverse(treenode *node, treenode *found[]) {
    if(node != NULL) {
                        traverse(node->left, found);
                        *(found++) = node;
                        traverse(node->right, found);


It doesn't work properly.
That is, not ALL nodes are in the array!
I think the problem is in the increment, but I cannot find an other way
(using a for(...;...;..++) is impossible, I think).

I have to post this work on Sunday, please help me!

Thank you Sandra

Sent via http://www.*-*-*.com/
Before you buy.

Mon, 15 Apr 2002 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. HELP!: non-recursive binary tree inorder traversal algorithm

2. Level order Traversal of a Binary Tree ??

3. given preorder and postorder traversals of a binary tree How can we find inorder

4. binary tree traversal

5. HELP with Huffman Tree Traversal - huff2.c (1/1)

6. HELP with Huffman Tree Traversal - huff2.c (1/1)

7. HELP with Huffman Tree Traversal - huff2.c (0/1)

8. HELP Huffman Tree Traversal

9. directory tree traversal

10. How to make more fast TREE traversal ?

11. Tree traversal - inorder preorder postorder ??

12. AVL tree (Binary Balanced tree) using C or C++


Powered by phpBB® Forum Software