retagged by
530 views

3 Answers

3 votes
3 votes

Answer : 642211431136

Here, => means prints.

 

mystery2(-2) => null

mystery2(-1) => null

mystery2(0) => null

mystery2(1) => 1 mystery2(-1) mystery2(-2) 1 => 11

mystery2(2) => 2 mystery2(0) myster2(-1) 2 => 22

mystery2(3) => 3 mystery2(1) myster2(0) 3 => 3113

mystery2(4) => 4 mystery2(2) myster2(1) 4 => 422114

mystery2(5) => 5 mystery2(3) myster2(2) 5 => 53113225

mystery2(6) => 6 mystery2(4) myster2(3) 6 => 642211431136

0 votes
0 votes

Answer is 642211431136

Let the function mystery2() be represented as m() for ease. And printf() be represented as p().

Then we create a recursion tree (as shown).

  • We can directly execute the print statements.(No need to show in recursion tree). This is done here for first print statement of the function.

Answer:

Related questions

4 votes
4 votes
3 answers
1
GO Classes asked Mar 26, 2022
587 views
What will be the output printed by $\text{mystery}3(6)$?void mystery3(int n) { if (n == 0 || n == 1) return; mystery3(n-2); printf("%d", n); mystery3(n-1); }
5 votes
5 votes
3 answers
3
9 votes
9 votes
2 answers
4