Given below are some algorithms, and some algorithm design paradigms.
Match the above algorithms on the left to the corresponding design paradigm they follow.
View worked solution
Answer: C
We can determine the correct matching by analyzing the design paradigm of each algorithm:
- 1. Dijkstra's Shortest Path: This algorithm finds the single-source shortest path by greedily selecting the vertex with the minimum tentative distance at each step. Thus, it follows the Greedy design (iii).
- 2. Floyd-Warshall Algorithm: This algorithm computes all-pairs shortest paths by solving overlapping subproblems (considering paths through a subset of intermediate vertices ). Thus, it uses Dynamic Programming (ii).
- 3. Binary Search: It divides the sorted array into two halves, compares the target with the middle element, and recursively searches in one of the halves. Thus, it follows the Divide and Conquer (i) paradigm.
- 4. Backtracking Search: Backtracking explores a graph or state-space tree by going as deep as possible along each branch before backtracking. This traversal strategy is fundamentally a Depth-first search (iv).
Combining these matches:
This corresponds to the match: 1-iii, 2-ii, 3-i, 4-iv, which is Option C.
Free practice · Your answers on this page are not saved.
