Fractional Knapsack - Online Code


This code solves the Fractional Knapsack problem.

Source Code

#include <stdio.h>

	 int n = 5; /* The number of objects */

	 int c[10] = {12, 1, 2, 1, 4}; /* c[i] is the *COST* of the ith object; i.e. what

					YOU PAY to take the object */

	 int v[10] = {4, 2, 2, 1, 10}; 
... (login or register to view full code)

To view full code, you must Login or Register, its FREE.

Hey, registering yourself just takes less than a minute and opens up a whole new GetGyan experience.


No comment yet. Be the first to post a comment.