Question

In: Computer Science

, we are given a set of n items. Each item weights between 0 and 1....

, we are given a set of n items. Each item weights between 0 and 1. We also have a set of bins (knapsacks). Each bin has a capacity of 1, i.e., total weight in any bin should be less than 1. The problem is to pack the items into as few bins as possible. For example Given items: 0.2, 0.5, 0.4, 0.7, 0.1, 0.3, 0.8 Opt Solution: Bin1[0.2, 0.8], Bin2[0.5, 0.4, 0.1], Bin3[0.7, 0.3] Each item must be placed in a bin before the next item can be pro- cessed. This problem is NP-hard. Give an approximation algorithm to solve the bin packing problem. Provide pseudo-code, time complexity analysis and proof of performance ratio.

Solutions

Expert Solution


Related Solutions

The data provided below is the same for each item in a set of interrelated items...
The data provided below is the same for each item in a set of interrelated items about the FIFO approach to processes costing. Only the question asked tends to differ from item to item. Together this set of items addresses the same problem. Students are encouraged to work the ENTIRE problem out on scratch paper before responding to any items that relate to this problem. Knuckle makes t-shirts. It uses the FIFO approach to process costing and has a single-stage...
c++ The input items are given in one line and each item is separated by white...
c++ The input items are given in one line and each item is separated by white spaces (blank-space and tab). how can I implement? and input: 34 peach 7 output: number: 34 7 string: peach How can I separate the numbers and characters that I type at once?
Problem 1: Given an array A[0 ... n-1], where each element of the array represents a...
Problem 1: Given an array A[0 ... n-1], where each element of the array represents a vote in the election. Assume that each vote is given as integers representing the ID of the chosen candidate. Write the code determining who wins the election. Problem 2: How do we find the number which appeared maximum number of times in an array? ( Use Java and an original code )
Given an array A[0 … n-1], where each element of the array represent a vote in...
Given an array A[0 … n-1], where each element of the array represent a vote in the election. Assume that each vote is given as an integer representing the ID of the chosen candidate. Can you determine who wins the election? What is the complexity of your solution? Hint: it is similar to finding the element that is repeated the maximum number of times.
Given a difference equation x[n+2] + 5x[n+1]+6x[n]=n with start values x[0]= 0 and x[1]=0
Given a difference equation x[n+2] + 5x[n+1]+6x[n]=n with start values x[0]= 0 and x[1]=0
Using Java, Given an array A[0 ... n-1], where each element of the array represent a...
Using Java, Given an array A[0 ... n-1], where each element of the array represent a vote in the election. Assume that each vote is given as an integer representing the ID of the chosen candidate. Can you determine who wins the election? What is the complexity of your solution? Hint: it is similar to finding the element that is repeated the maximum number of times.
Q1- Given a set S = {1, 2, . . . , n} of players, with...
Q1- Given a set S = {1, 2, . . . , n} of players, with skill levels a1, a2, . . . , an, we need to partition the set of players S into two teams S1 and S2 of equal total skill. The teams do not need to be of equal size. However, every player must be in exactly one team. In other words, S1 ∪ S2 = S                                        (1) S1 ∩   S2 = ∅                                                     (2) Σ ak=...
We are preparing a master production schedule for a given item. For this item the demand...
We are preparing a master production schedule for a given item. For this item the demand forecast and booked orders are as follows: Week 1 2 3 4 5 6 Demand Forecast 60 60 80 80 80 50 Booked Orders 58 63 52 20 4 0 Our Week 0 projected on-hand is 132 units. Lead time for this item is 2 weeks, and the order policy for this item is a fixed quantity of 180 units. When this master schedule...
Given an array A[1..n], with distinct values and k with 1 ≤ k ≤ n. We...
Given an array A[1..n], with distinct values and k with 1 ≤ k ≤ n. We want to return the k smallest element of A[1.....n], in non-decreasing order. For example: A = [5, 4, 6, 2, 10] and k = 4, the algorithm returns [2, 4, 5, 6]. There are at least the following four approaches: a. heapify A and then extract k elements one by one b. sort the array (e.g. using MergeSort or HeapSort) and then read the...
(2) Let Z/nZ be the set of n elements {0, 1, 2, . . . ,...
(2) Let Z/nZ be the set of n elements {0, 1, 2, . . . , n ? 1} with addition and multiplication modulo n. (a) Which element of Z/5Z is the additive identity? Which element is the multiplicative identity? For each nonzero element of Z/5Z, write out its multiplicative inverse. (b) Prove that Z/nZ is a field if and only if n is a prime number. [Hint: first work out why it’s not a field when n isn’t prime....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT