Question: Consider the C function foo and the binary tree shown. typedef struct node { int val; struct node * left , * right; } node;

Consider the C function foo and the binary tree shown.
typedef struct node {
int val;
struct node *left,*right;
} node;
int cse(node *p){
int retval;
if (p = NULL)
return 0;
else {
retval = p->val + foo(p->left)+ foo(p->right);
printf("%d ", retval);
return retval;
}
}
When foo is called with a pointer to the root node output ?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!