Recursion_DS

Recursion_DS

University

7 Qs

quiz-placeholder

Similar activities

Cha-ching 2

Cha-ching 2

1st Grade - University

8 Qs

Riistvara

Riistvara

10th Grade - University

12 Qs

Computer Network

Computer Network

University

10 Qs

BOOLEAN CLUB QUIZ 1

BOOLEAN CLUB QUIZ 1

University

10 Qs

Métricas de Calidad

Métricas de Calidad

University

10 Qs

HTML Quiz

HTML Quiz

University

10 Qs

Quiz Informatica Jornadas Orientación Asunción

Quiz Informatica Jornadas Orientación Asunción

12th Grade - University

10 Qs

Animasi PAT

Animasi PAT

University

10 Qs

Recursion_DS

Recursion_DS

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

Jeena KK

Used 1+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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)