GATE / CS ARCHIVE

SIMILAR QUESTIONS / ALGORITHMS

Match named algorithms to design paradigms

4 questions solved the same way, newest first. Back to Algorithms

How these are solved

Each task supplies multiple named algorithms and requires a correspondence to greedy, dynamic programming, divide-and-conquer and traversal/backtracking paradigms. Map every algorithm separately using its construction; retain differing lists and options.

1 mark · MCQ
Report issue

Other / Mixed Topics

Question 5, GATE 2017: Match P Kruskal, Q Quicksort, R Floyd–Warshall to i divide and conquer, ii greedy, iii dynamic programming. A P-ii Q-iii R-i; B P-iii Q-i R-ii; C P-ii Q-i R-iii; D P-i Q-ii R-iii.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

1. Kruskal sorts edges by weight and repeatedly accepts a cheapest edge that does not form a cycle. This is the greedy paradigm ii.

2. Quicksort partitions around a pivot, recursively sorts the two resulting parts, and combines their order: divide and conquer i.

3. Floyd–Warshall updates distances by allowing intermediate vertices one at a time: Dk[i,j]=min(Dk−1[i,j],Dk−1[i,k]+Dk−1[k,j]). Reused subproblem values make it dynamic programming iii. Thus C.

Original paper, page 4 · Answer key

1 mark · MCQ
Report issue

Other / Mixed Topics

Question 13, GATE 2015: Match algorithms P Prim MST, Q Floyd–Warshall all-pairs shortest paths, R mergesort, S Hamiltonian circuit search with i backtracking, ii greedy, iii dynamic programming, iv divide-and-conquer. A P-iii Q-ii R-iv S-i; B P-i Q-ii R-iv S-iii; C P-ii Q-iii R-iv S-i; D P-ii Q-i R-iii S-iv.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Prim greedily adds a cheapest edge crossing the current tree's cut. Floyd–Warshall builds shortest paths by increasing the allowed intermediate vertices, a dynamic-programming recurrence. Mergesort solves two smaller sorting problems and merges their answers. A standard Hamiltonian-circuit search tries vertices and abandons partial paths that cannot extend, illustrating backtracking.

Solution: Prim uses greedy selection; Floyd–Warshall uses dynamic programming; mergesort uses divide and conquer; the standard Hamiltonian-circuit search uses backtracking. Thus P-ii, Q-iii, R-iv, S-i, C.

Original paper, page 7 · Answer key

2 marks · MCQ
Report issue

Other / Mixed Topics

Question 47, GATE 2015: Match algorithms 1Dijkstra, 2Floyd–Warshall, 3 binary search, 4 backtracking with i divide/conquer, ii dynamic programming, iii greedy, iv DFS, v BFS. A1i2 iii 3i4v; B1 iii 2 iii 3i4v; C1 iii 2 ii 3i4 iv; D1 iii 2 ii 3i4v.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Dijkstra uses greedy finalization; Floyd–Warshall uses dynamic programming; binary search divides the search interval; backtracking explores depth first. Hence 1-iii, 2-ii, 3-i, 4-iv, C.

Dijkstra commits the currently smallest tentative distance using a greedy safe-choice argument. Floyd–Warshall improves paths by allowing successively larger sets of intermediate vertices, which is dynamic programming. Binary search reduces the search interval to one half, matching divide-and-conquer here. Backtracking explores one partial-choice path before undoing it and trying another, so its traversal is depth-first rather than breadth-first. The complete matching is 1 iii, 2 ii, 3i, 4 iv.

Original paper, page 42 · Answer key

1 mark · MCQ
Report issue

Matching algorithm paradigms

Other / Mixed Topics

Question 1.5, GATE 1997: Match all-pairs shortest paths, quicksort, minimum spanning tree, connected components with dynamic programming, divide-and-conquer, greedy, DFS.
Question 1.5, GATE 1997: Match all-pairs shortest paths, quicksort, minimum spanning tree, connected components with dynamic programming, divide-and-conquer, greedy, DFS.
Tap to enlarge
Your answer
Answer & solution

Answer: B: 3, 4, 1, 2 (no official key was published)

Floyd–Warshall solves all-pairs paths through dynamic-programming subproblems. Quicksort partitions around a pivot and recursively sorts subarrays, a divide-and-conquer strategy. Prim or Kruskal builds an MST using safe greedy edge choices. Repeated DFS visits each connected component. Thus the four matches are 3, 4, 1, 2, option B. These refer to standard representative algorithms rather than asserting that each task has only one possible solution paradigm.

Original paper, page 1