Bird
0
0

If an elevator system uses a simple nearest-elevator algorithm, what is the expected behavior when two elevators are equally close to a request floor?

medium📝 Analysis Q5 of 15
LLD - Design — Elevator System
If an elevator system uses a simple nearest-elevator algorithm, what is the expected behavior when two elevators are equally close to a request floor?
AAssign the elevator that is moving away from the request
BAssign the elevator with the lower ID number
CAssign the elevator with fewer current passengers
DAssign the elevator that is idle or moving towards the request
Step-by-Step Solution
Solution:
  1. Step 1: Understand tie-breaking in nearest-elevator algorithm

    When distances tie, the elevator moving towards the request or idle is preferred to reduce wait time.
  2. Step 2: Evaluate other options

    Passenger count or ID number are not standard tie-breakers; moving away increases wait time.
  3. Final Answer:

    Assign the elevator that is idle or moving towards the request -> Option D
  4. Quick Check:

    Tie-breaker = Elevator moving towards request [OK]
Quick Trick: Prefer elevators moving towards request in ties [OK]
Common Mistakes:
MISTAKES
  • Choosing elevator moving away
  • Using arbitrary ID numbers
  • Ignoring elevator direction

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes