1. Engineering
  2. Computer Science
  3. problem 4 consider the recursive cfunction below void foounsigned int...

Question: problem 4 consider the recursive cfunction below void foounsigned int...

Question details

PROBLEM 4: Consider the recursive C+function below: void foo(unsigned int n) if(n-0) cout << tick << endl; else foo(n-1); foo(n-1); foo(n-1) 4.A: Complete the following table indicating how many ticks are printed for various parameters n. Unenforceable rule: derive your answers by handnot simply by writing a program calling the function. number of ticks printed when foo(n) is called 2 4 4.B: Derive a conjecture expressing the number of ticks as a function of n .e., complete the following: Conjecture: for all n20, calling foo(n) results in being printed ticks 4.C: Prove your conjecture from part B (hint Induction!)

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