Question

For given capacity of knapsack W and n items {i1,i2,...,in} with its own value {v1,v2,...,vn} and...

For given capacity of knapsack W and n items {i1,i2,...,in} with its own value {v1,v2,...,vn} and weight {w1,w2,...,wn}, find a greedy algorithm that solves fractional knapsack problem, and prove its correctness.

And, if you naively use the greedy algorithm to solve 0-1 knapsack problem with no repetition, then the greedy algorithm does not ensure an optimal solution anymore. Give an example that a solution from the greedy algorithm is not an optimal solution for 0-1 knapsack problem.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

For example if we have Sack size=7 items with weight wt value 1 valueſ weight 9บ 1 1 1.33 3 4 5 I init 1.25 1.4 If we apply g

NOTE: I TRIED TO IMPLEMENT THE REQUESTED PROBLEM AS PER BEST OF MY UNDERSTANDING....IF YOU NEED ANY SORT OF HELP REGARDING THIS PROBLEM , PLEASE DO MENTION IN COMMENTS.....IF YOU GOT ANY SORT OF HELP THROUGH THIS ARTICLE PLEASE DO UPVOTE.....THANKYOU!!!

Add a comment
Know the answer?
Add Answer to:
For given capacity of knapsack W and n items {i1,i2,...,in} with its own value {v1,v2,...,vn} and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT