First Fit (FF) requires 10m bins: Why

  • Thread starter zak100
  • Start date
  • Tags
    Fit
In summary: Hi,Thanks, I am able to understand now.In summary, the author's problem is that there are too many items of size 1/2 + Absolon for a single bin. To solve the problem, he suggests using a distribution where each item of size 1/2 + Absolon is divided among six bins.
  • #1
zak100
462
11
TL;DR Summary
Hi,
I am trying to read Algorithm book of Allen Weiss which says that FF requires .
Hi,

I am having problem in understanding the following text of the book:
The input consists of 6m items of size 1/7+ Absolon, followed by 6m items of size 1/3+ Absolon , followed by 6m items of size 1/2 + Absolon. One simple packing places one item of each size in a bin and requires 6m bins.
My solution:

If m = 1 then its possible to have 6 bins.

All1/7 elements would go into 1 bin.

All 6*1/3 items would go into 2 bins

All 6 *1/2 items would go into 3 bins.
Total = 6 bins

It further says:

First fit requires 10m bins.
Why First Fit would require 10 bins? I think First Fit would also require 6 bins.
Somebody please guide me why First Fit would need 10 bins?

Zulfi.
 
Technology news on Phys.org
  • #2
zak100 said:
The input consists of 6m items of size 1/7+ Absolon, followed by 6m items of size 1/3+ Absolon , followed by 6m items of size 1/2 + Absolon. One simple packing places one item of each size in a bin and requires 6m bins.
You mean "epsilon", not "absolon".

So, I think this is what it says (but please verify).
Input consists of:
6m items of size ##(1/7)+\epsilon##
6m items of size ##(1/3)+\epsilon##
6m items of size ##(1/2)+\epsilon##

It's unclear how big these bins are, but since one of each fits into a single bin, they have to be at least ##((1/7)+(1/3)+(1/2)+3*\epsilon) = ((41/42) + 3*\epsilon)##

Perhaps we should assume that the bins are of size 1. Is there something in the problem statement that states this?

So the problem with you solution is that you are ignoring the ##\epsilon##. That ##\epsilon## should be taken as a small but finite value. For example, take ##\epsilon = 0.001## then fill those bins again.
 
Last edited:
  • Like
Likes zak100
  • #3
Hi,

If we would consider epsilon as 0.001
then

##6 * 1/2 + 0.001## would be greater than 3. So by this optimal should not require 6 bins. It should be more than 6. So first we have to find why optimal requires 6 bins?

ZUlfi.
 
  • #4
zak100 said:
∗1/2+0.0016∗1/2+0.0016 * 1/2 + 0.001 would be greater than 3. So by this optimal should not require 6 bins. It should be more than 6. So first we have to find why optimal requires 6 bins?
But to find the optimal distribution, you have to consider all distributions of the items. .Scott already gave one
distribution where the items do fit in 6 bins. (1 piece of each size in each bin). The total size of the items is too large to fit in 5 bins, so the optimal packing uses 6 bins.
 
  • Like
Likes zak100
  • #5
Hi,

Thanks, I am able to understand now.

I did the following calculation:

a ==0.00795

==

1/7+0.00795=0.15075*6 = 0.9045 (1 bin)

½ +0.00795=0.50795= (6 bins)

1/3+.00795 = 0.3333+.00795= 0.34125 (2 can fit in one bin) and 6 will require 3 bin . Therefore 1 + 6 +3= 10bins
first fit requiring 10 bin.jpg
 
  • Like
Likes .Scott
  • #6
@zak100 :
But I would suggest you make: ##\epsilon \le \frac{1}{126}##
That way, ##(1/2+\epsilon)+(1/3+\epsilon)+(1/7+\epsilon) \le 1##
and the 6-bin solution works.
 
  • Like
Likes zak100

1. What is First Fit (FF)?

First Fit (FF) is a popular algorithm used in computer science for allocating resources. It is commonly used in memory management to allocate space in computer memory for programs and data.

2. How does First Fit (FF) work?

First Fit (FF) works by allocating resources in the first available location that is large enough to fit the resource. This means that the resource may not be placed in the most optimal location, but it is placed in the first available spot that is big enough to hold it.

3. Why does First Fit (FF) require 10m bins?

First Fit (FF) requires 10m bins because it is designed to allocate resources in the first available location. In order to do this efficiently, the bins must be large enough to hold a variety of resource sizes. By having bins that are 10m in size, it is more likely that there will be a suitable spot available to allocate the resource.

4. What are the pros and cons of using First Fit (FF)?

One of the main pros of using First Fit (FF) is that it is a simple and efficient algorithm. It requires minimal processing time and can quickly allocate resources. However, one of the cons is that it may not always find the most optimal location for the resource, leading to potential fragmentation of resources.

5. Is First Fit (FF) the best algorithm for resource allocation?

This is a difficult question to answer definitively as it depends on the specific use case and the resources being allocated. First Fit (FF) is a popular and widely used algorithm, but there are other algorithms such as Best Fit and Worst Fit that may be more suitable in certain situations. It is important to consider the specific needs and constraints of the system when choosing an allocation algorithm.

Similar threads

  • Programming and Computer Science
Replies
4
Views
905
  • Programming and Computer Science
Replies
9
Views
2K
  • Programming and Computer Science
Replies
5
Views
4K
Replies
5
Views
880
  • Set Theory, Logic, Probability, Statistics
Replies
18
Views
3K
  • Programming and Computer Science
Replies
3
Views
683
  • Programming and Computer Science
Replies
27
Views
2K
  • Programming and Computer Science
Replies
17
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
6
Views
1K
  • Programming and Computer Science
Replies
2
Views
323
Back
Top