Skip to content
Related Articles

Related Articles

ISRO | ISRO CS 2017 | Question 47
  • Difficulty Level : Basic
  • Last Updated : 16 Mar, 2018

Which of the following permutation can be obtained in the same order using a stack assuming that input is the sequence 5, 6, 7, 8, 9 in that order?
(A) 7, 8, 9, 5, 6
(B) 5, 9, 6, 7, 8
(C) 7, 8, 9, 6, 5
(D) 9, 8, 7, 5, 6


Answer: (C)

Explanation: The sequence given in option (C) is one of the only possible sequence which can be obtained.
We can obtain the sequence by performing operations in the manner:
Push 5
Push 6
Push 7
Pop 7
Push 8
Pop 8
Push 9
Pop 9
Pop 6
Pop 5.
hence the sequence will be 7,8,9,6,5.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :