Bird
Raised Fist0

Given the LOOK algorithm with head starting at 40 and requests at [10, 20, 35, 70, 90], what is the order of servicing requests if the head moves towards higher track numbers first?

medium📝 Analysis Q13 of Q15
LLD - Design — Elevator System
Given the LOOK algorithm with head starting at 40 and requests at [10, 20, 35, 70, 90], what is the order of servicing requests if the head moves towards higher track numbers first?
A[40, 90, 70, 35, 20, 10]
B[40, 70, 90, 100, 35, 20, 10]
C[40, 35, 20, 10, 70, 90]
D[40, 70, 90, 35, 20, 10]
Step-by-Step Solution
Solution:
  1. Step 1: LOOK moves towards higher requests first

    Starting at 40, it services 70 and 90, stopping at last request 90.
  2. Step 2: LOOK reverses direction

    Then it moves down servicing 35, 20, and 10, stopping at last request in that direction.
  3. Final Answer:

    [40, 70, 90, 35, 20, 10] -> Option D
  4. Quick Check:

    LOOK stops at last request, no disk edge [OK]
Quick Trick: LOOK stops at last request, no disk edge [OK]
Common Mistakes:
MISTAKES
  • Including disk edge in LOOK path
  • Reversing direction too early
  • Skipping requests on the way

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes