Thread: Displaying tree thru inorder

  1. #1
    Lord CyKill
    Guest

    Displaying tree thru inorder

    I want to traverse a tree using inorder travesal and displaying the contents of the node. But dont know how to do since got no idea about inorder traversal.Ne body HELP!

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981

  3. #3
    Open to suggestions Brighteyes's Avatar
    Join Date
    Mar 2003
    Posts
    204
    I want to traverse a tree using inorder travesal and displaying the contents of the node.
    Go left, display, go right. Pretty straightforward
    Code:
    void inorder(struct node *tree, void (*display)(struct node *))
    {
        inorder(tree->left, display);
        display(tree);
        inorder(tree->right, display);
    }
    p.s. What the alphabet would look like without q and r.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  2. Binary Tree, couple questions
    By scoobasean in forum C Programming
    Replies: 3
    Last Post: 03-12-2005, 09:09 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM