in Algorithms retagged by
6,950 views
25 votes
25 votes

Given below are some algorithms, and some algorithm design paradigms.$$\begin{array}{ll|ll}\hline \text{1.} & \text{Dijkstra's Shortest Path} & \text{i.} & \text{Divide and Conquer} \\\hline  \text{2.} & \text{Floyd-Warshall algorithm to compute} & \text{ii.}& \text{Dynamic Programming} \\& \text{ all pairs shortest path} \\\hline   \text{3.}& \text{Binary search on a sorted array} & \text{iii.}  & \text{Greedy design} \\\hline  \text{4.} & \text{Backtracking search on a graph} &\text{iv.}  & \text{Depth-first search} \\\hline  &  &\text{v.}  & \text{Breadth-first search}  \\\hline \end{array}$$
Match the above algorithms on the left to the corresponding design paradigm they follow.

  1. $\text{1-i, 2-iii, 3-i, 4-v}$
  2. $\text{1-iii, 2-iii, 3-i, 4-v}$
  3. $\text{1-iii, 2-ii, 3-i, 4-iv}$
  4. $\text{1-iii, 2-ii, 3-i, 4-v}$
in Algorithms retagged by
7.0k views

3 Answers

23 votes
23 votes
Best answer
Option C.

Dijkstra's Shortest path algorithm uses greedy design (always chosing the shortest neighbour) while Floyd Warshall Algorithm to compute all shortest paths uses Dynamic Programming.
Binary search uses Divide and Conquer (though we eliminate one part at each time) and Back tracking traversal to a graph uses Depth First Search (DFS) (in DFS we have to backtrack to a node after searching through all its descendant nodes if the searched node is not found).
selected by
21 votes
21 votes
Answer: C

4 Comments

U can follow any standard book, will get  it
1
1
ya got it. Didn't read the que properly. It is asked just for graph search and I was thinking about all algorithms using bfs and dfs. Thank you.
1
1
backtracking paradigm in the syllabus?
0
0
0 votes
0 votes
I feel its D. We start with the destination node and backtrack in breadth First manner. We don't reach to the starting node in Depth first manner... But evaluating the shortest Path at each level. Which is BFS clearly.
IDK why everybody.. ACE, ME and GateCse wrote that as C...!
Open for criticism.

1 comment

read this link may be it will help you DFS is actually a backtracking..a kind of subset you can say.. 

http://stackoverflow.com/questions/1294720/whats-the-difference-between-backtracking-and-depth-first-search

0
0
Answer: