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?
- A3, 4, 5, 1, 2
- B3, 4, 5, 2, 1
- C1, 5, 2, 3, 4
- D5, 4, 3, 1, 2
Solve it on GATE DA practice →More Basic Data Structures problems