Data Structures & AlgorithmsModerateTCS Digital · Infosys SP

Which application does NOT naturally use a stack?

  1. A. Evaluating a postfix expression
  2. B. Breadth-first traversal of a graph
  3. C. Checking balanced parentheses
  4. D. Undo in a text editor

Correct answer: B. Breadth-first traversal of a graph

BFS processes vertices level by level, which needs a FIFO queue. Undo, postfix evaluation and bracket matching are all last-in-first-out.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic