Multiple chairs in a vertical pile is an example of which of the following data structure?
Multiple chairs in a vertical pile is an example of which of the following data structure?
Solution
A pile of chairs stacked vertically follows LIFO (Last In, First Out): the chair placed last on top is the first one removed, and you cannot take one from the middle or bottom without removing those above it. This is exactly how a stack works, with push and pop happening at one end (the top).
Queue: follows FIFO, with insertion at the rear and removal from the front, like people standing in a line.
Deque: allows insertion and removal at both ends, which a vertical pile does not allow.
Remember the everyday examples: stack of plates, books or chairs is a stack, and a ticket line is a queue.
Related questions:
2025: 13 May Shift 2
2026: 20 May Shift 1
2025: 27 May Shift 2