GATE CS 1994 · Arrays & Matrix Representation

MCQ · 1 mark · Problem PROG-DSTR-0270

Which of the following permutations can be obtained in the output (in the same order) using a stack assuming that the input is the sequence 1, 2, 3, 4, 5 in that order?
  1. A
    3, 4, 5, 1, 2
  2. B
    3, 4, 5, 2, 1
  3. C
    1, 5, 2, 3, 4
  4. D
    5, 4, 3, 1, 2

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: Option B.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/2457/gate1994-1-14

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com