Looking for CS341 - Data Structures and Algorithms S4 - F25 test answers and solutions? Browse our comprehensive collection of verified answers for CS341 - Data Structures and Algorithms S4 - F25 at moodle.medtech.tn.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Output?----------------------------
int f(int n){
if(n == 2) return 4;
return f(n+2) - 1;
}
f(0);
What is printed?-------------------------
void fun(int n){
if(n < 0) return;
System.out.print(n + " ");
fun(n-2);
}
fun(5);
Which of the following MUST exist in every correct recursive function?
The time complexity of computing Fibonacci recursively is:
Does this function always terminate?-------------------------------------------------
int f(int n){
System.out.print(n);
return f(n-1);
}
Which function is MOST likely to cause exponential complexity when recursive?
If a recursive function splits the problem into 2 subproblems of size n/2, the complexity is generally:
Which condition is a correct base case?
The base case is used to:
Recursion without a base case leads to: