edited by
6,962 views
3 3 votes

Consider the following steps:

$S_1$: Characterize the structure of an optimal solution

$S_2$: Compute the value of an optimal solution in bottom-up fashion

Which of the following step(s) is/are common to both dynamic programming and greedy algorithms?

  1. Only $S_1$
  2. Only $S_2$
  3. Both $S_1$ and $S_2$
  4. Neither $S_1$ nor $S_2$

3 Answers

2 2 votes
Ans. A

Both Dp and greedy algorithms find optimal substructure in the problem but only DP uses the bottom up approach.
0 0 votes
Opton (A): only S1

Because both greedy algo and dynamic programming finds the optimal solution for their problems but ,

only dynamic programming uses bottom-up approach

whereas,greedy algo uses top-bottom approach
0 0 votes
option A) Only S1 , because both dynamic and greedy finds optimal solution but only dynamic programming computes the value by following a Bottom up approach.
Answer:
Position:
Show:

Related questions

0 0 votes
1 1 answer
113
113 views
Shubham Sharma 2 asked Apr 19
113 views
Match the LIST-I with LIST-IILIST-ILIST-IIA.Dynamic programmingI.Floyd Warshall Shortest pathB.GreedyII.Huffman codingC.Back trackingIII.Hamiltonian cycle problemD.Branch...
3 3 votes
2 answers 2 answers
957
957 views
Bikram asked May 26, 2017
957 views
Match the following:$\begin{array}{|l|l|l|l|} \hline (1) & \text{Multistage graph} & (P) & \text{Divide and conquer}\\ \hline (2) & \text{Convex hull } & (Q) & \text{Dept...
0 0 votes
2 2 answers
3.8k
3.8k views
Lakshman Bhaiya asked Nov 13, 2018
3,827 views
Consider the following code segment to find the $n^{th}$ Fibonacci number:Fib(n) { if(n==0) {return 0;} if(n==1) {return 1;} else { return(Fib(n-1) + Fib(n...
1 1 vote
1 1 answer
7.4k
7.4k views
Tuhin Dutta asked Dec 13, 2017
7,421 views
Unlike greedy algorithms, dynamic programming method always provide correct/optimal solution.Is the above statement correct?