1. Engineering
  2. Computer Science
  3. this is from chapter 2 of computer systems fourth edition...

Question: this is from chapter 2 of computer systems fourth edition...

Question details

This is from Chapter 2 of Computer Systems (Fourth Edition) by J. Stanley Warford.

2.2e

Part 1) Draw the call tree for the call statement from the main program for binCoeff(4,2).

Part 2) How many times is the function called?

Part 3) What is the maximum number of stack frames on the run-time Stack during execution, including main.

Part 4) In what order does the program make the calls and returns.

64 Chapter 2 C++ #include <iostream> using namespace std; int binCoeff (int n. int k)f int yl, y2; (nk)) ( if ((k0) return 1: else y1 binCoeff (n 1, k): / ra2 y2 binCoeff (n 1, k 1); // ra3 return yi y2: int main () f cout <<binCoeff (3, 1)binCoeff (3, 1); // ral cout < endl: return 0 Output binCoeff(3, 1) -3 Figure 2.29(e) shows the return from binCoeff(l. 1). yl gets th returned by the function. Then the y2 assignment statement calls the binCoeff(1, 0). Figure 2.29(f) shows the run-time stack duui

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution