Which of the following is not an application of a stack?
2025
Which of the following is not an application of a stack?
Answer: D. line at ticket counter — ConceptA stack is a last-in, first-out (LIFO) data structure: the most recently inserted item is the first one removed. A queue is a first-in, first-out…
- A.
evaluation of post-fix expression
- B.
conversion of infix to post-fix expression
- C.
balancing symbols
- D.
line at ticket counter
Attempted by 842 students.
Show answer & explanation
Correct answer: D
Concept
A stack is a last-in, first-out (LIFO) data structure: the most recently inserted item is the first one removed.
A queue is a first-in, first-out (FIFO) data structure: the earliest inserted item is the first one removed.
Application
To identify the non-stack application, compare the order in which each activity stores and retrieves items with the LIFO rule.
Contrast
Evaluation of a post-fix expression stores operands and retrieves the most recent operands when an operator is processed, so it uses LIFO access.
Conversion of an infix expression to post-fix form stores operators and retrieves the most recent eligible operator according to precedence, so it uses LIFO access.
Balancing symbols stores unmatched opening symbols and compares each closing symbol with the most recent unmatched opening symbol, so it uses LIFO access.
A line at a ticket counter serves the earliest arrival first, so it uses FIFO access rather than LIFO access.
Result
Therefore, a line at a ticket counter is not an application of a stack; it models a queue.