You are consulting for a trucking company that does a large amount of business shipping
packages between New York and Boston. The volume is high enough that they
have to send a number of trucks each day between the two locations. Trucks have a
fixed limit W on the maximum amount of weight they are allowed to carry. Boxes
arrive at the New York station one by one, and each package i has a weight wi
. The
trucking station is quite small, so at most one truck can be at the station at any time.
Company policy requires that boxes are shipped in the order they arrive; otherwise, a
customer might get upset upon seeing a box that arrived after his make it to Boston
faster. At the moment, the company is using a simple greedy algorithm for packing:
they pack boxes in the order they arrive, and whenever the next box does not fit, they
send the truck on its way