Given below are some algorithms, and some algorithm design paradigms.
List-I A. Dijkstra’s Shortest Path B. Floyd-Warshall algorithm to compute all pairs shortest path C. Binary search on a sorted array D. Backtracking search on a graph List-II 1. Divide and Conquer 2. Dynamic Programming 3. Greedy design 4. Depth-first search 5. Breadth-first search
Match the above algorithms on the left to the corresponding design paradigm they follow
Codes:
A B C D (a) 1 3 1 5 (b) 3 3 1 5 (c) 3 2 1 4 (d) 3 2 1 5
(A) a
(B) b
(C) c
(D) d
Answer: (C)
Explanation:
Dijkstra’s Shortest Path is a Greedy Algorithm. Floyd-Warshall algorithm is Dynamic Programming. Binary search is a Divide and Conquer. Backtracking is Depth-first search