Question: 4. Given the following code: Mystery (n) { if (n == 1) return; else { for j = 1 to n*n { print (j);

4. Given the following code: Mystery (n) { if (n == 1) return; else { for j = 1 to n*n { print (j); } Mystery (n/2) Mystery (n/2) Mystery (n/2) Mystery (n/2) } } Mystery (n/2) a) What is the recurrence relation for the function? b) Explain how you determined the recurrence relation? c) What is the notation for this recurrence relation? Show your work! d) How many times does Print (j) execute?
Step by Step Solution
There are 3 Steps involved in it
a Recurrence relation The recurrence relation for the function Mystery is Tn 5Tn2 n2 b Determining t... View full answer
Get step-by-step solutions from verified subject matter experts
