recursion in binary trees problem newbie

This is a discussion on recursion in binary trees problem newbie within the C++ Programming forums, part of the General Programming Boards category; hi, im not sure what the output is in this piece of code for the following linked list [22]->[3]->[10]->[95]->[64]->[35]->[14] //////////////////////////////////////////////////// ...

  1. #1
    totalfreeloader
    Guest

    recursion in binary trees problem newbie

    hi, im not sure what the output is in this piece of code
    for the following linked list

    [22]->[3]->[10]->[95]->[64]->[35]->[14]

    ////////////////////////////////////////////////////

    typedef struct Node * Nodeptr;
    struct Node {
    int data;
    Nodeptr Next;
    };

    void Process (Nodeptr X)
    {
    if(X != NULL) {
    Process(X -> Next);
    if( X -> Data % 5 == 0) {
    cout<< X-> Data <<endl;
    }
    }
    }

    ///////////////////////////////////////////////////////
    much appreciated

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,681
    Looks like it should be:
    35
    95
    10
    I used to be an adventurer like you... then I took an arrow to the knee.

  3. #3
    totalfreeloader
    Guest
    thanx very much, thats what i thought,

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Search Tree-Strange problem
    By lydiab in forum C Programming
    Replies: 12
    Last Post: 05-13-2009, 07:39 AM
  2. Newbie in problem with looping
    By nrain in forum C Programming
    Replies: 6
    Last Post: 11-05-2005, 11:53 AM
  3. Problem with Binary File I/O
    By DirX in forum C++ Programming
    Replies: 4
    Last Post: 03-01-2004, 08:34 AM
  4. Binary trees search problem...
    By Umoniel in forum C Programming
    Replies: 2
    Last Post: 02-22-2004, 01:29 PM
  5. Newbie questions regarding binary search trees
    By Ham in forum C++ Programming
    Replies: 1
    Last Post: 11-04-2001, 06:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21