GATE / CS ARCHIVE

GATE CSE 2017 SET 1 / QUESTION 5

GATE CSE 2017 Set 1 Q5

Algorithms · Other / Mixed Topics · Full GATE CSE 2017 Set 1 paper

GATE 2017 Set 1, Q5 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