Container packing

National 4 container packing looks at First-fit algorithm in particular.

For National 5 the aim is to minimise the amount of containers used.

There is no set way of doing this but one method is described below.

First- fit decreasing algorithm

The following items to be packed into boxes that can hold up to 10kg:

Weight ( kg) 7 8 4 4 2 2 3 5 8 3

The first-fit decreasing algorithm puts the items in order of heaviest to lightest.

Weight ( kg) 8 8 7 5 4 4 3 3 2 2

Now continue as you would with the first-fit algorithm by putting each item into the first container that has room for it.

An algorithm to show how available sections fit into boxesThe first-fit decreasing algorithm only uses five boxes.