I am practicing for an exam and one of the exercises is:

Find an example sequence where FFD (offline) performs better than BFD (offline).

Intuitively I would say no such sequence exists as the sequence is sorted, but I have not managed to find a counterexample or proof.

  • 12
    $\begingroup$ FFD? BFD? More context would probably be helpful. $\endgroup$ Commented Jan 17, 2017 at 17:44

1 Answer 1


Isn't First/Best Fit Decreasing always considered offline (requiring sorting the input assumed unsorted)?
Anyway, let me assume "performs better" to mean uses less bins.
I find it annoyingly hard to try to find an example using a minimum number of items, of item values and minimum item values - and to argue convincingly that it is minimal, but

try a bin size of 16 and items of 11, 6, 6, 3, 2, 2, 2. Bin contents after adding each item:
- FF: 11 11,6 11,12 14,12 16,12 16,14 16,16
- BF: 11 11,6 11,12 11,15 13,15 15,15 15,15,2


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.