
Recursion_DS

Quiz
•
Computers
•
University
•
Hard
Jeena KK
Used 1+ times
FREE Resource
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)
Similar Resources on Wayground
11 questions
Data Structures - Training: Quiz 1

Quiz
•
University
9 questions
Métodos de Ordenamiento

Quiz
•
University
10 questions
searching quiz

Quiz
•
University
10 questions
Árboles AVL y sus características

Quiz
•
12th Grade - University
7 questions
Quiz 1

Quiz
•
University
10 questions
Quiz 1

Quiz
•
University
10 questions
Class_23_08_2024

Quiz
•
University
10 questions
Avaliação de Laboratório de WEB

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University