0-1 knapsack problem

This is a discussion on 0-1 knapsack problem within the C Programming forums, part of the General Programming Boards category; Hi, I am looking for a C source code that can implement dynamic programming for 0-1 knapsack problem. briefly the ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    7

    0-1 knapsack problem

    Hi,
    I am looking for a C source code that can implement dynamic programming for 0-1 knapsack problem. briefly the knapsack problem is as follows;

    The knapsack can contain at most 100kg and here are the objects in the market.
    Name Weight Value
    A 45 3
    B 40 5
    C 50 8
    D 90 10
    The optimal solution will be taking objects B and C from the market. WB:40, WC:50 (40+50<100) and
    values of objects B and C WB:5, WC:8. (with total value 5+8=13)
    thank you.

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by madennn View Post
    Hi,
    I am looking for a C source code that can implement dynamic programming for 0-1 knapsack problem.
    If you want someone to provide some code:

    Freelancers Network - freelance projects uk
    http://www.rent-acoder.com/

    Don't expect someone here to just do it for you for nothing.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by madennn View Post
    Hi,
    I am looking for a C source code that can implement dynamic programming for 0-1 knapsack problem. briefly the knapsack problem is as follows;

    The knapsack can contain at most 100kg and here are the objects in the market.
    Name Weight Value
    A 45 3
    B 40 5
    C 50 8
    D 90 10
    The optimal solution will be taking objects B and C from the market. WB:40, WC:50 (40+50<100) and
    values of objects B and C WB:5, WC:8. (with total value 5+8=13)
    thank you.
    Read this --> C Board - Announcements in Forum : General Programming Boards

    Moreover, you won't learn a thing using scoop and poop (copy and paste) coding. It won't make you a good programmer, it will make you a good thief who can't program.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Knapsack Problem
    By Fork in forum C Programming
    Replies: 4
    Last Post: 11-13-2006, 11:42 AM
  5. Multiple Knapsack Problem
    By polymeta in forum C Programming
    Replies: 3
    Last Post: 11-15-2001, 07:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21