|
|
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 |
|
There is no answer at this time. |
|
There are no comments at this time. |
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 Home - Answers FAQ - Terms of Service - Privacy Policy |