subject

Suppose you are in charge of unloading containers from ships arriving at a port onto trucks. A ship arrives with n containers of weight w1, w2, . . . , wn tons. Standing on the dock is a set of trucks, each of which can hold 1 ton of weight. (You can assume that none of the containers weighs more than 1 ton, since in this case you would not be able to transport it.) You can stack multiple containers in each truck subject to the weight restriction of 1 ton. Hoping to minimize your truck rental expenses, you aim to minimize the number of trucks needed in order to carry all the containers. You start with the following greedy strategy. Start with an empty truck and begin loading containers 1, 2, 3, ... onto it until you get to a container that would overflow the weight limit. Now, declare this truck "loaded" and send it off; then continue the process with a fresh truck. After trying (and failing) to prove that this greedy algorithm is optimal, you decide to attempt to come up with a counter-example to see if you can discover that your strategy is not optimal.

Required:
Provide an example of a set of weights for which your algorithm does not use the minimum possible number of trucks.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:00
Which of the following ā€œinvisibleā€ marks represents an inserted tab?
Answers: 1
question
Computers and Technology, 23.06.2019 07:30
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
question
Computers and Technology, 23.06.2019 12:20
When guido van rossum created python, he wanted to make a language that was more than other programming languages. a. code-based b. human-readable c. complex d. functional
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
You can apply several different worksheet themes from which tab?
Answers: 1
You know the right answer?
Suppose you are in charge of unloading containers from ships arriving at a port onto trucks. A ship...
Questions
question
Mathematics, 31.07.2020 03:01
question
Mathematics, 31.07.2020 03:01