
Recursion_DS
Quiz
•
Computers
•
University
•
Practice Problem
•
Hard
Jeena KK
Used 1+ times
FREE Resource
Enhance your content in a minute
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
void printNumbers(int n) {
if (n <= 0) {
return;
}
printNumbers(n - 1);
cout << n << " ";
}
int main() {
printNumbers(5);
return 0;
}
5 4 3 2 1
1 2 3 4 5
1 1 1 1 1
5 5 5 5 5
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
void printNumbers(int n) {
if (n <= 0) {
return;
}
cout << n << " ";
printNumbers(n - 1);
}
int main() {
printNumbers(5);
return 0;
}
5 4 3 2 1
1 2 3 4 5
1 1 1 1 1
5 5 5 5 5
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
int mystery(int n) {
if (n <= 0) {
return 0;
}
return (n % 10) + mystery(n / 10);
}
int main() {
cout << mystery(12345) << endl;
return 0;
}
15
10
14
9
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes the time complexity of a recursive algorithm with a recurrence relation of T(n) = T(n/2) + O(1)?
O(n log n)
O(n)
O(log n)
O(1)
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes the time complexity of a recursive algorithm with a recurrence relation of T(n) = T(n/2) + n?
O(n log n)
O(n)
O(log n)
O(1)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes the time complexity of a recursive algorithm with a recurrence relation of T(n) = T(n-1) + O(1)?
O(n log n)
O(n)
O(log n)
O(1)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes the time complexity of a recursive algorithm with a recurrence relation of T(n) = T(n-1) + n?
O(n log n)
O(n^2)
O(log n)
O(n)
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
12 questions
Porcentajes
Quiz
•
University
10 questions
Web-II-Loop and Function
Quiz
•
University
11 questions
NHÓM 3: XÁC ĐỊNH DỰ ÁN
Quiz
•
University
10 questions
Procesadores de Texto
Quiz
•
2nd Grade - University
10 questions
Condicionales en Racket
Quiz
•
University
10 questions
Algorithm analysis: divide & conquer theory
Quiz
•
University
10 questions
Programacion Orientada a Objetos
Quiz
•
12th Grade - University
10 questions
Information systems concepts
Quiz
•
University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
