Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > recursive

Thread Tools

Posts: n/a

red floyd wrote:
> jw wrote:
> > how does it return to x after printing 2?
> >

> OK, guys, from this it's most likely homework.

And it is riddled with syntax errors...thing doesn't even compile, let
alone print anything.

Reply With Quote
Posts: n/a

"jw" <(E-Mail Removed)> wrote in message

>> Look at your code:
>> void printTree(t)
>> if(t.left!=NULL)
>> print("(");
>> printTree(t.left);
>> print(t.element);
>> if(t.right!=NULL)
>> printTree(t.right);
>> print(")");
>> It prints the left: "(" + "2", then itself: "x", then the right: "(5-1)"
>> +
>> ")".

> ok but after this how does it return to the real root the print the
> rightmost.

If you can't figure it out by now, ask your teacher for help.


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recursive functions Vs Non-recursive functions - performance aspect vamsi C Programming 21 03-09-2009 10:53 PM
Two recursive calls inside of a recursive function n00m C++ 12 03-13-2008 03:18 PM
Recursive function Tyron VHDL 1 04-16-2004 07:20 AM
recursive description with generate and processes Joerg Ritter VHDL 10 12-06-2003 10:24 PM
NCVHDL/NCELAB and Recursive Instantiation Anand P Paralkar VHDL 2 11-10-2003 06:14 PM