bool fun1() {if (root) return doFun1(root); else return false;}
bool doFun1(Node *ptr){
if(ptr->left) doFun1(ptr->left);
if(ptr->right) doFun1(ptr->right);
if(ptr->left) doFun1(ptr->left);
ptr->data=ptr->data*7;
if (ptr->data>500) cout<<.5*ptr->data<<endl;
else if (ptr->data<50) cout<<5*ptr->data<<endl;
return true;}
int main( ) {
Tree t;
t.insert(14);t.insert(13);t.insert(31);t.insert(27);t.insert(12);
t.fun1();
return 0;}
I am trying to trace through this and the output is giving:
294 \\<12*7*7*0.5
661.5 \\<27*7*7*0.5
2058
14406
318.5
i understand where the first two come from (see beside them) i just can't figure out the later 3 any help helping me see the recursion would be greatly appreciated