Recursion_DS

Recursion_DS

University

7 Qs

quiz-placeholder

Similar activities

DBMS - Hash Indexing

DBMS - Hash Indexing

University

10 Qs

HEAP TREE

HEAP TREE

University

11 Qs

Complexity Analysis Station [2]

Complexity Analysis Station [2]

University

7 Qs

Revisando a Aula 2 Estrutura de Dados

Revisando a Aula 2 Estrutura de Dados

University

7 Qs

BCSC0006 Trees

BCSC0006 Trees

University

10 Qs

Big O Notation

Big O Notation

University

7 Qs

ed Hat System Administration I - Test 2B

ed Hat System Administration I - Test 2B

University

9 Qs

Binary Search Tree

Binary Search Tree

University

7 Qs

Recursion_DS

Recursion_DS

Assessment

Quiz

Computers

University

Hard

Created by

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)