Consider the following heap (figure) in which blank regions are not in use and…
1994

Consider the following heap (figure) in which blank regions are not in use and hatched region are in use.
The sequence of requests for blocks of size 300, 25, 125, 50 can be satisfied if we use
- A.
either first fit or best fit policy (any one)
- B.
first fit but not best fit policy
- C.
best fit but not first fit policy
- D.
None of the above
Attempted by 34 students.
Show answer & explanation
Correct answer: B
Using First Fit
Free list initially: [150, 350]
300 → fits in 350 → leaves 50
Free: [150, 50]
25 → first hole is 150 → leaves 125
Free: [125, 50]
125 → fits exactly in 125
Free: [50]
50 → fits exactly in 50
✅ All requests satisfied
Using Best Fit
Free list initially: [150, 350]
300 → best fit is 350 → leaves 50
Free: [150, 50]
25 → best fit is 50 → leaves 25
Free: [150, 25]
125 → best fit is 150 → leaves 25
Free: [25, 25]
50 → no block large enough
❌ Fails
hence option 2 is correct
A video solution is available for this question — log in and enroll to watch it.