Question 1 (35 marks)
This question is to be attempted individually. Consider the following pseudocode:
int fint(n) {
if (n > 1) {
fint(n/2);
fint(n/2);
for (int i = 1; i <= gn; i++) {
println("Hello world!");
fint(n/2);
}
}
}
int gint(n) {
int sum = 0;
for (int i = 1; i <= n; i++) {
sum += i;
}
return sum;
}
Here, println is a function that prints a line of text. Assume n is a power of 2.
Solve the recurrence in c, showing your working steps. For full credit, give the exact answer, not big-O, and do not use the Master Theorem. [20 marks]