retagged by
7,021 views
25 votes
25 votes

Consider the following table:

$$\begin{array}{|l|}\hline \textbf {Algorithms} & \textbf{Design Paradigms } & \\\hline  \text{P. Kruskal} & \text{i. Divide and Conquer}   \\\hline  \text{Q. Quicksort} & \text{ii. Greedy}  \\\hline  \text{R. Floyd-Warshall} & \text{iii. Dynamic Programming}\\\hline  \end{array}$$

Match the algorithms to the design paradigms they are based on.

  1. $(P) \leftrightarrow (ii), (Q) \leftrightarrow (iii), (R) \leftrightarrow (i)$
  2. $(P) \leftrightarrow (iii), (Q) \leftrightarrow (i), (R) \leftrightarrow (ii)$
  3. $(P) \leftrightarrow (ii), (Q) \leftrightarrow (i), (R) \leftrightarrow (iii)$
  4. $(P) \leftrightarrow (i), (Q) \leftrightarrow (ii), (R) \leftrightarrow (iii)$
retagged by

7 Answers

1 votes
1 votes

Answer will be Option C .

Quicksort is a divide and conquer technique.
while Kruskal algorithms work to find the minimum weight so it takes a greedy approach .
Floyd Warshell for all-pair shortest path uses Dynamic programming with a time complexity o(n3).

1 votes
1 votes
(P) Kruskal’s and Prim’s algorithms for finding Minimum Spanning Tree(MST). To find MST we are using greedy technique.
(Q) QuickSort is a Divide and Conquer algorithm.
(R) Floyd Warshall Algorithm is for solving the All Pairs Shortest Path problem using Dynamic Programming.
1 votes
1 votes
Some important points regarding Greedy Vs Dynamic Programming
Greedy: →
It always gives polynomial time complexity
→ It is not an optimal
→ It always selects only either minimum or maximum among all possibilities
→ Ex: Dijkstra’s algorithm for SSSP, Optimal Merge Pattern, Huffman coding, Fractional knapsack problem, etc..,
Dynamic Programming:
→ It gives either polynomial or exponential time complexity.
→ It gives always an optimal result.
→ It checks all possibilities of a problem.
→ Ex: Longest Common sequence, Matrix chain Multiplication, Travelling sales Problem, etc..,
Answer:

Related questions

25 votes
25 votes
3 answers
1
go_editor asked Feb 12, 2015
7,062 views
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 a...
21 votes
21 votes
3 answers
2
Kathleen asked Sep 29, 2014
5,063 views
The correct matching for the following pairs is$$\begin{array}{ll|ll}\hline \text{A.} & \text{All pairs shortest path} & \text{1.} & \text{Greedy} \\\hline \text{B.} & \...
11 votes
11 votes
1 answer
3
makhdoom ghaya asked Nov 19, 2016
5,888 views
Match the pairs in the following questions:$$\begin{array}{|ll|ll|}\hline (a) & \text{Strassen's matrix multiplication algorithm} & (p) & \text{Greedy method} \\\hline (...
26 votes
26 votes
4 answers
4
makhdoom ghaya asked Feb 12, 2015
5,600 views
Match the following:$$\begin{array}{|ll|ll|}\hline \text{P.} & \text{Prim's algorithm for minimum spanning tree} & \text{i.} & \text{Backtracking} \\\hline \text{Q.}...