double foo (int n) {
int i;
double sum;
if (n == 0) return 1.0;
else {
sum = 0.0;
for (i = 0; i < n; i++)
sum += foo(i);
return sum;
}
}Related Algorithms PYQs
Suppose there are ⌈log n⌉ sorted lists of ⌊n / log n⌋ elements each. The time complexity of producing a sorted list of all these e…
Suppose T(n) = 2T(n / 2) + n, T(0) = T(1) = 1. Which one of the following is FALSE?
The Asymptotic Notation of computing the transitive closure of a binary relation on a set of n elements is known to be:
Let G(V,E) be an undirected graph with positive edge weights. Dijkstra's single source shortest path algorithm can be implemented …
We are given 9 tasks T1, T2... T9 with execution time 1 unit each. Task profits and deadlines (Pi, di) are: T1:(15,7), T2:(20,2), …
For the task scheduling instance in the previous question, which tasks are left out in the schedule that gives maximum profit?
Free account benefits
Turn practice into measurable progress
Public PYQs and reference pages stay free. Sign in when you want GATEverse to remember what you studied and guide what to practise next.