Divide and Conquer · Algorithms
6 questions · asked in 5 of 27 years (2000–2026)
MCQ 4 · NAT 21-mark 4 · 2-mark 2
2000Questions per year2026
Questions 1–5 of 6
Consider a sequence of 14 elements: A = [-5, -10, 6, 3, -1, -2, 13, 4, -9, -1, 4, 12, -3, 0]. The sequence sum . Determine the maximum of S(i,j), where . (Divide and conquer approach may be used). Answer:______
Answer: 29
Apply Kadane's method: keep a running sum and start again when it becomes negative.
5 and 10 are left out. Start from 6. The running sums are 6, 9, 8, 6, 19, 23, 14, 13, 17, 29, 26, 26.
The maximum subarray is 6 + 3 1 2 + 13 + 4 9 1 + 4 + 12 = 29.
Answer: 29
5 and 10 are left out. Start from 6. The running sums are 6, 9, 8, 6, 19, 23, 14, 13, 17, 29, 26, 26.
The maximum subarray is 6 + 3 1 2 + 13 + 4 9 1 + 4 + 12 = 29.
Answer: 29
Consider the following table:
Match the algorithms to the design paradigms they are based on.
Match the algorithms to the design paradigms they are based on.
Answer: (C)
Match each algorithm one by one:
- Kruskal: it takes the cheapest safe edge every time Greedy (ii)
- Quicksort: it splits the array and calls itself on the parts Divide and Conquer (i)
- Floyd-Warshall: it uses answers of smaller subproblems Dynamic Programming (iii)
Answer: P-(ii), Q-(i), R-(iii)
- Kruskal: it takes the cheapest safe edge every time Greedy (ii)
- Quicksort: it splits the array and calls itself on the parts Divide and Conquer (i)
- Floyd-Warshall: it uses answers of smaller subproblems Dynamic Programming (iii)
Answer: P-(ii), Q-(i), R-(iii)
Match the following:
Answer: (C)
Match each item one by one:
- Prim's MST uses the greedy method (ii)
- Floyd-Warshall uses dynamic programming (iii)
- Mergesort uses divide and conquer (iv)
- Hamiltonian circuit uses backtracking (i)
Answer: P-ii, Q-iii, R-iv, S-i
- Prim's MST uses the greedy method (ii)
- Floyd-Warshall uses dynamic programming (iii)
- Mergesort uses divide and conquer (iv)
- Hamiltonian circuit uses backtracking (i)
Answer: P-ii, Q-iii, R-iv, S-i
Given below are some algorithms, and some algorithm design paradigms.
Match the above algorithms on the left to the corresponding design paradigm they follow.
Match the above algorithms on the left to the corresponding design paradigm they follow.
Answer: (C)
Match each algorithm with the idea it uses:
- 1. Dijkstra's shortest path: greedy design (iii). At each step it picks the closest unvisited vertex and never changes that choice later.
- 2. Floyd-Warshall: dynamic programming (ii). It builds shortest paths through vertices 1 to from the stored answers for 1 to , so the same smaller subproblems are reused.
- 3. Binary search on a sorted array: divide and conquer (i). It compares with the middle element and then searches only one half.
- 4. Backtracking search on a graph: depth-first search (iv). It goes as deep as it can along one path and, when it gets stuck, steps back and tries another branch. Breadth-first search (v) explores level by level and does not step back along a path.
So the match is 1-iii, 2-ii, 3-i, 4-iv.
Answer: (C)
- 1. Dijkstra's shortest path: greedy design (iii). At each step it picks the closest unvisited vertex and never changes that choice later.
- 2. Floyd-Warshall: dynamic programming (ii). It builds shortest paths through vertices 1 to from the stored answers for 1 to , so the same smaller subproblems are reused.
- 3. Binary search on a sorted array: divide and conquer (i). It compares with the middle element and then searches only one half.
- 4. Backtracking search on a graph: depth-first search (iv). It goes as deep as it can along one path and, when it gets stuck, steps back and tries another branch. Breadth-first search (v) explores level by level and does not step back along a path.
So the match is 1-iii, 2-ii, 3-i, 4-iv.
Answer: (C)
The minimum number of comparisons required to find the minimum and the maximum of 100 numbers is _________________.
Answer: 147.1 to 148.1
First, group the numbers into pairs and compare each pair. This takes 50 comparisons. Next, find the maximum among the 50 larger numbers, which takes 49 comparisons. Then find the minimum among the 50 smaller numbers, which also takes 49 comparisons.
Total comparisons:
Answer: 148
Total comparisons:
Answer: 148
Keep practising