Bird
0
0

In designing an elevator system with Elevator, Floor, and Request classes, which approach best handles multiple simultaneous requests efficiently?

hard📝 Trade-off Q15 of 15
LLD - Design — Elevator System
In designing an elevator system with Elevator, Floor, and Request classes, which approach best handles multiple simultaneous requests efficiently?
AUse a priority queue in Elevator to process requests by nearest floor and direction
BProcess requests in the order they arrive without sorting
CAssign each request to a random elevator immediately
DIgnore direction and always move elevators to the highest requested floor first
Step-by-Step Solution
Solution:
  1. Step 1: Understand multiple request handling

    Efficient elevator systems prioritize requests to minimize travel and wait time.
  2. Step 2: Evaluate options for request processing

    Using a priority queue to pick nearest floors and matching direction optimizes movement. Others cause inefficiency or randomness.
  3. Final Answer:

    Use a priority queue in Elevator to process requests by nearest floor and direction -> Option A
  4. Quick Check:

    Priority queue for nearest requests = Use a priority queue in Elevator to process requests by nearest floor and direction [OK]
Quick Trick: Prioritize nearest requests with direction for efficient elevator movement [OK]
Common Mistakes:
MISTAKES
  • Ignoring direction leads to inefficient routes
  • Random assignment causes delays
  • Processing requests strictly by arrival order wastes time

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes