Thread: Print numbers by inorder..

  1. #1
    Compiling
    Join Date
    Jun 2003
    Posts
    69

    Question Print numbers by inorder..

    Could anyone give me an idea about how to print all the numbers in a binary search tree by inorder? Thx a lot!

  2. #2
    Registered User Sargnagel's Avatar
    Join Date
    Aug 2002
    Posts
    166
    Please, try searching the forum next time first. These standard questions have been asked many times before.

    http://cboard.cprogramming.com/showt...hlight=inorder

  3. #3
    Compiling
    Join Date
    Jun 2003
    Posts
    69
    sure!
    thx for ur help!

  4. #4
    Compiling
    Join Date
    Jun 2003
    Posts
    69

    Question

    but I had a question about how this code works?
    it seems that the recursion do not have a base case?

    Code:
      if(Root!=NULL) 
      { 
        Inorder(Root->Left); 
        printf("%s\n", Root->Data); 
        Inorder(Root->Right); 
      }

  5. #5
    Registered User Sargnagel's Avatar
    Join Date
    Aug 2002
    Posts
    166
    I love google!

    Here is a wonderful explanation including source code (I think it's Pascal) and animated GIFs.

    http://www.cs.usask.ca/resources/tut...ntree/2-2.html

  6. #6
    root
    Join Date
    Sep 2003
    Posts
    232
    >it seems that the recursion do not have a base case?
    Looks like a base case to me:
    Code:
    if(Root!=NULL)
    {
      Inorder(Root->Left);
      printf("%s\n", Root->Data);
      Inorder(Root->Right);
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help to print even numbers
    By ortegac in forum C Programming
    Replies: 3
    Last Post: 05-21-2006, 12:01 AM
  2. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 08:26 PM
  3. Adding Line numbers in Word
    By Mister C in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 06-24-2004, 08:45 PM
  4. What kind of programs should I start writing?
    By Macabre in forum C++ Programming
    Replies: 23
    Last Post: 04-12-2003, 08:13 PM
  5. A (complex) question on numbers
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 02-03-2002, 06:38 PM