Consider the following recursive C function. Void get (int n) { if (n<1) return; get (n-1) ; get (n-3) ; printf (‘’%d’’, n); } If get (6) function is being called in main() then how many times will the get ( ) function be invoked before returning to the main() ?
Consider the following recursive C function. Void get (int n) { if (n<1) return; get (n-1) ; get (n-3) ; printf (‘’%d’’, n); } If get (6) function is being called in main() then how many times will the get ( ) function be invoked before returning to the main() ? Correct Answer 25
[ alt="F2 R.S Madhu 17.01.20 D1" src="//storage.googleapis.com/tb-img/production/20/01/F2_R.S_Madhu_17.01.20_D1.png" style="width: 560px; height: 381px;">
Total 24 + 1 = 25 times get() function will be invoked.
Last 1 call will be of get (6).
Recurrence relation for this will be: T(n) = T (n-1) + T (n- 3) + 2