Google Answers Logo
View Question
 
Q: C Code for knapsack "greedy" algorithms ( No Answer,   0 Comments )
Question  
Subject: C Code for knapsack "greedy" algorithms
Category: Computers > Algorithms
Asked by: h6330-ga
List Price: $25.00
Posted: 05 May 2005 16:18 PDT
Expires: 04 Jun 2005 16:18 PDT
Question ID: 518256
3 types of "Greedy" algorithms for the knapsack problem.
1) Greedy value -- consider items in order of decreasing value
2) Greedy Value density -- consider items in order of decreasing value
density (Value/Size)
3) Panic -- consider items in their indexed order. 

Items 1 and 2 will have run time cost of Theta(n log n)(because of the
proper sorting method, such as quicksort), and Item 3 will have a run
time cost of Theta (n).

Sizes and values should be scaled so that they lie in 1...r and the
knapsack capacity is r*n/4, where n is the number of random sets of
size and value.

Need C or C++ code (preferrably C) that will compile using Visual C++
Version 6.0 and the Standard MSDN library set.

Thanks
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy