wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Quiz on Divide and Conquer Approach

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the first step in the divide and conquer method?

a)

Divide the input into subsets

b)

Combine the solutions of sub-problems

c)

Solve the problem directly

d)

Check the input size of the problem

2.

Which of the following is a classic problem that can be solved using divide and conquer?

a)

Bubble sort

b)

Linear search

c)

Binary search

d)

Finding the greatest common divisor

3.

What is a disadvantage of the divide and conquer algorithm?

a)

It is less efficient than iterative algorithms

b)

It cannot solve large problems

c)

It is not suitable for parallel implementation

d)

It may require more space due to recursion

4.

In the control abstraction of the divide and conquer algorithm, what does the function Is-Small(P) do?

a)

Combines the solutions of sub-problems

b)

Divides the problem into sub-problems

c)

Returns the final solution

d)

Checks if the problem can be solved directly

5.

What is the time complexity of the best-case scenario for binary search?

a)

O(1)

b)

O(n)

c)

O(log n)

d)

O(n log n)

6.

How does the binary search algorithm determine which half of the array to search next?

a)

By using a linear search in both halves

b)

By searching both halves simultaneously

c)

By finding the middle element and comparing

d)

By comparing the search key with the last element

7.

What is the recurrence relation for the worst-case of binary search?

a)

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

b)

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

c)

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

d)

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

8.

What is the time complexity of the merge sort algorithm?

a)

O(n)

b)

O(n^2)

c)

O(n log n)

d)

O(log n)

9.

In the merge sort algorithm, what is the purpose of the Merge function?

a)

To divide the array into sub-arrays

b)

To find the middle element of the array

c)

To combine two sorted lists into one sorted list

d)

To sort the array in descending order

10.

What is the general form of the recurrence relation for divide and conquer algorithms?

a)

T(n) = k(n)

b)

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

c)

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

d)

T(n) = aT(n/b) + h(n)