Knapsack problem, Huffman Code, Single Source Shortest Path ...
Knapsack problem, Huffman Code, Single Source Shortest Path ...
Knapsack problem, Huffman Code, Single Source Shortest Path ...
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 />
Example: Consider the following instance of the knapsack<br />
<strong>problem</strong>:<br />
n=3, M=20, (P 1 , P 2 , P 3 ) = (25, 24, 15), (w 1 , w 2 , w 3 ) = (18, 15, 10).<br />
four feasible solutions are:<br />
Sr.No (x 1 , x 2 , x 3 )<br />
w i x i<br />
p i xi<br />
1 (1/2, 1/3, 1/4) 16.5 24.25<br />
2 (1, 2/15, 0) 20 28.2<br />
3 (0, 2/3, 1) 20 31<br />
Maximum 4 (0, profit 1, 1/2) per unit of 20capacity used 31.5<br />
7