Lab: Coin Change & Bin Packing


Bin Packing Algorithm


Step 1: Sort the sections in terms of their sizes in decreasing order. 

Step 2: Set Count to 0 

Step 3: Assign sections to a minibus until the summation of the section sizes are less than or equal to C (the capacity of the minibus). Always choose the largest sized section from the sorted list of sections left. 

Step 4: Set Count to Count + 1 

Step 5: Repeat step 3 and step 4 until 0 sections left. 

Step 6: Return Count