wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CL/ARVR

Total questions: 15

Worksheet time: 15mins

Name
Class
Date
1.

What does the Master Theorem provide a solution for?

a)

a) Space complexity of algorithms

b)

b) Time complexity of divide-and-conquer algorithms

c)

c) Sorting algorithms

d)

d) Dynamic programming algorithms

2.

Which scenario would make the Master Theorem inapplicable?

a)

a) When the subproblems cannot be solved independently

b)

b) When the size of the subproblems decreases by a constant factor at each step

c)

c) When the problem size decreases exponentially with each recursive call

d)

d) When the time complexity cannot be expressed as a recurrence relation

3.

What is the time complexity of the merge sort algorithm?

a)

a) O(n)

b)

b) O(n log n)

c)

c) O(n^2)

d)

d) O(1)

4.

What is the space complexity of the binary search algorithm?

a)

a) O(1)

b)

b) O(log n)

c)

c) O(n)

d)

d) O(n^2)

5.

What is the space complexity of Bubble Sort?

a)

a) O(1)

b)

b) O(log n)

c)

c) O(n)

d)

d) O(n^2)

6.

Which of the following scenarios is BFS well-suited for?

a)

a) Finding the maximum flow in a network

b)

b) Topological sorting of a graph

c)

c) Finding the shortest path between two vertices in an unweighted graph

d)

d) Solving the traveling salesman problem

7.

Which of the following data structures is used to keep track of visited vertices in BFS to avoid revisiting them?

a)

a) Stack

b)

b) Queue

c)

c) Hash Table or Set

d)

d) Binary Search Tree

8.

Which of the following data structures is used to implement priority queue?

a)

a) Stack

b)

b) Queue

c)

c) Heap

d)

d) Linked List

9.

What is the space complexity of the depth-first search (DFS) algorithm?

a)

a) O(n)

b)

b) O(log n)

c)

c) O(n^2)

d)

d) O(1)

10.

DFS is often used to find:

a)

a) Shortest paths in graphs

b)

b) Longest paths in graphs

c)

c) Cycles in graphs

d)

d) All-pairs shortest paths in graphs

11.

Which of the following recurrence relations can be solved using the substitution method?

a)

a) T(n) = T(n/2) + n

b)

b) T(n) = 2T(n/2) + n

c)

c) T(n) = T(n-1) + n

d)

d) T(n) = T(n-1) + 1

12.

What is the key principle behind the substitution method?

a)

a) Breaking down complex problems into simpler subproblems.

b)

b) Substituting variables to simplify mathematical expressions.

c)

c) Making educated guesses and verifying them through induction.

d)

d) Iteratively refining algorithms to improve performance.

13.

In Big O notation, what does O(n) represent?

a)

a) Constant time complexity

b)

b) Linear time complexity

c)

c) Quadratic time complexity

d)

d) Exponential time complexity

14.

Which sorting algorithm is not recommended for large datasets due to its poor time complexity?

a)

a) Insertion Sort

b)

b) Quick Sort

c)

c) Merge Sort

d)

d) Bubble Sort

15.

Which searching algorithm is commonly used to search in trees and graphs?

a)

a) Linear Search

b)

b) Binary Search

c)

c) Depth-First Search

d)

d) Breadth-First Search