Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@manish-r2Hoep • Mar 6, 2010
Greedy approach means to choose best among all the possible solutions
for eg if we consider a knapsack problem
we have a knapsack of capacity 20kg
and 3 diamonds
1 diamond =cost 4 crore, weight 20 kg
2 diamond =cost 3 crore ,weight 15 kg
3 diamond =cost 2 crore weight 10 kg
then According to greedy approach You will go for 1st diamond of 20 kg
According to dynamic programming,,you will choose best solution by storing all the possible solution in a table and using that you will select best solution
Of both above mentioned approaches dynamic programming is best for finding optimal solution..
for further knowledge i will recommend you to go for "Introduction to algorithms "By Kormen