Bird
0
0

Which of the following is a valid data structure to store the list of floors an elevator must visit?

easy🧠 Conceptual Q3 of 15
LLD - Design — Elevator System
Which of the following is a valid data structure to store the list of floors an elevator must visit?
AStack
BQueue
CSet
DDictionary
Step-by-Step Solution
Solution:
  1. Step 1: Understand elevator floor visit order

    Elevators typically visit floors in the order requests are received, so a queue (FIFO) fits well.
  2. Step 2: Analyze other data structures

    Stack (LIFO) reverses order, set has no order, dictionary is key-value and not suitable for ordered visits.
  3. Final Answer:

    Queue -> Option B
  4. Quick Check:

    Floor list = Queue [OK]
Quick Trick: Use queue for ordered floor visits [OK]
Common Mistakes:
MISTAKES
  • Using stack reverses order
  • Using set loses order
  • Dictionary not for ordered lists

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LLD Quizzes