0% found this document useful (0 votes)
8 views

Bin Packing Algorithms

The document contains 3 homework questions on bin packing algorithms for allocating items of various volumes to containers of fixed capacity. Question 1 applies first fit and first fit decreasing algorithms to pack rucksacks for hikers. Question 2 uses quicksort and first fit decreasing to optimally cut wood pieces into 1m lengths. Question 3 applies first fit and first fit decreasing to record radio programs onto tapes of fixed capacity.

Uploaded by

Stuart Gregory
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Bin Packing Algorithms

The document contains 3 homework questions on bin packing algorithms for allocating items of various volumes to containers of fixed capacity. Question 1 applies first fit and first fit decreasing algorithms to pack rucksacks for hikers. Question 2 uses quicksort and first fit decreasing to optimally cut wood pieces into 1m lengths. Question 3 applies first fit and first fit decreasing to record radio programs onto tapes of fixed capacity.

Uploaded by

Stuart Gregory
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

AS Further Mathematics Homework

Bin Packing Algorithms


Question 1
Two hikers each have a 25 litre rucksack to pack. The items to be packed have volumes of 14, 6,
11, 9 and 6 litres.

i) Apply the first fit algorithm to the items in the order given and comment on the outcome.
[3]
ii) Write the five items in descending order of volume. Apply the first fit decreasing algorithm to
find a packing for the rucksacks.
[3]
iii) The hikers argue that the first fit decreasing algorithm does not produce a fair allocation of
volumes to rucksacks. Produce a packing which gives a fairer allocation of volumes between
the two rucksacks. Explain why the hikers might not want to use this packing.
[2]
Question 2
650 431 245 643 455 134 710 234 162 452

i) The list of numbers above is to be sorted into descending order. Perform a Quick Sort to
obtain the sorted list, giving the state of the list after each pass, indicating the pivot elements.
[5]

The numbers in the list represent the lengths, in mm, of some pieces of wood. The wood is sold in one
metre lengths.

ii) Use the first-fit decreasing bin-packing algorithm to determine how these pieces could be cut
from the minimum number of one metre lengths. (You should ignore wastage due to cutting.)
[4]
iii) Determine whether your solution to part (ii) is optimal. Give a reason for your answer.
[2]
Question 3
29 52 73 87 74 47 38 61 41

The numbers in the list represent the lengths in minutes of nine radio programmes. They are to be
recorded onto tapes which each store up to 100 minutes of programmes.

i) Obtain a lower bound for the number of tapes needed to store the nine programmes.
[2]
ii) Use the first-fit bin packing algorithm to fit the programmes onto the tapes.
[3]
iii) Use the first-fit decreasing bin packing algorithm to fit the programmes onto the tapes.
[3]

Total Marks [27]


AS Further Mathematics
Bin Packing Homework Solutions
Question 1
i) Rucksack 1: 14; 6 Rucksack 2: 11; 9
The final item will not fit in either bag.
[3]
ii) Order: 14, 11, 9, 6, 6
Rucksack 1: 14; 11 Rucksack 2: 9; 6; 6
[3]
iii) Rucksack 1: 14; 9 Rucksack 2: 11; 6; 6
The weights of the bags are unbalanced.
[2]
Question 2
i)

650 432 245 643 455 710 234 162 452 134

650 643 710 455 431 245 234 162 452 134

650 710 643 455 431 452 452 234 162 134

710 650 643 455 431 245 245 234 162 134

710 650 643 455 452 245 245 234 162 134

[5]
ii) Bin 1: 710+245
Bin 2: 650+234
Bin 3: 643+162+134
Bin 4: 455+452
Bin 5: 431
[4]
iii)
4116
=4.116
1000
∴ 5 bins needed
[2]
Question 3
i) = 5.02 so 6 tapes.
[2]

ii) Bin l: 29, 52


Bin 2: 73
Bin 3: 87
Bin 4: 74
Bin 5: 47,38
Bin 6: 61
Bin 7: 41
[3]

iii) Bin l: 87
Bin 2: 74
Bin 3: 73
Bin 4: 61, 38
Bin 5: 52, 47
Bin 6: 41, 29
[3]

You might also like