Question: Given the following program: 1 #include 2 3 void f (int l, int r) { 4 int m; 5 6 if (l>=r) { 7 return;
Given the following program:
1 #include
2
3 void f (int l, int r) {
4 int m;
5
6 if (l>=r) {
7 return;
8 }
9
10 m = (l+r) / 2;
11 fprintf (stdout, "call %d-%d ", l, m);
12 f (l, m);
13 fprintf (stdout, "call %d-%d ", m+1, r);
14 f (m+1, r);
15
16 return;
17 }
18
19 int main () {
20 f (0, 8);
21 }
draw the recursive tree generated by function f. For each recursive call, report the values of all parameters and the exact output generated by the procedure
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
