24.04.2015 Views

Knapsack problem, Huffman Code, Single Source Shortest Path ...

Knapsack problem, Huffman Code, Single Source Shortest Path ...

Knapsack problem, Huffman Code, Single Source Shortest Path ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4: The Greedy Method<br />

<strong>Knapsack</strong> <strong>problem</strong><br />

Given n objects and a knapsack. Object i has weight w i and<br />

knapsack has capacity M.<br />

If a fraction x i , 0 x i 1, of object i is placed into the<br />

knapsack, then a profit of p i x i is earned.<br />

Problem may be stated as-<br />

Maximize p i x i , 1 i n ........................(1)<br />

Subject to x M , 1 i n ........................(2)<br />

w i i<br />

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!