cs325HW8SU18.pdf - CS 325 Homework Assignment 8 Problem In the bin packing problem items of different weights(or sizes must be packed into a finite

# cs325HW8SU18.pdf - CS 325 Homework Assignment 8 Problem In...

• Homework Help
• savagegrenadier
• 1
• 40% (10) 4 out of 10 people found this document helpful

This preview shows page 1 out of 1 page.

CS 325- Homework Assignment 8 1 Problem:In the bin packing problem, items of different weights (or sizes) must be packed into a finite number of bins each with the capacity C in a way that minimizes the number of bins used. The decision version of the bin packing problem (deciding if objects will fit into <= k bins) is NP-complete. There is no known polynomial time algorithm to solve the optimization version of the bin packing problem. In this homework you will be examining two greedy approximation algorithms to solve the bin packing problem. First-Fit: Put each item as you come to it into the first (earliest opened) bin into which it fits. If there is no available bin then open a new bin. First-Fit-Decreasing: First sort the items in decreasing order by size, then use First-Fit on the resulting list. a) Give pseudo code and the running time for each of the approximation algorithms. b) Implement in C++. Both algorithms should be in a program called bin.cpp. Your program should read in a text file named bin.txt with multiple test cases as explained below and output to the terminal the • • • 