Divide N Conquer and Greedy Strategy
Divide N Conquer and Greedy Strategy
• Where, T (n) is the time for DANDC on ‘n’ inputs g (n) is the time to
complete the answer directly for small inputs and f (n) is the time for
Divide and Combine
• https://www.geeksforgeeks.org/introduction-to-divide-and-conquer-algorithm-data-structure-and-
algorithm-tutorials/
• https://stackoverflow.com/questions/25858500/solving-recurrence-tn-2tn-2-%CE%981-by-
substitution
• If the objects are already been sorted into non-increasing order of p[i] /
w[i] then the algorithm given below obtains solutions corresponding to
this strategy.
• First, we try to fill the knapsack by selecting the objects in some order:
∑PiXi=p1x1+p2x2+p3x3+p4x4+p5x5+p6x6+p7x7
=10*1+5*1+15*4/5+7*0+6*1+18*1+3*1
=10+5+12+6+18+3
=54
• Let n = 4, (P1, P2, P3, P4,) = (100, 10, 15, 27) and (d1 d2 d3 d4) = (2, 1, 2, 1).
• Find the feasible solutions and their values:
• https://www.geeksforgeeks.org/activity-selection-problem-greedy-
algo-1/