Given n items of different weights and bins each of capacity c, assign each item to a bin such that number of total used bins is minimized. It may be assumed that all items have weights smaller than bin capacity.
Example: Input: weight[] = {4, 8, 1, 4, 2, 1} Bin Capacity c = 10 Output: 2 We need minimum 2 bins to accommodate all items First bin contains {4, 4, 2} and second bin {8, 1, 1}
Input: weight[] = {9, 8, 2, 2, 5, 4} Bin Capacity c = 10 Output: 4 We need minimum 4 bins to accommodate all items.
Input: weight[] = {2, 5, 4, 7, 1, 3, 8}; Bin Capacity c = 10 Output: 3