Open In App
Related Articles

ISRO | ISRO CS 2017 | Question 47

Improve Article
Improve
Save Article
Save
Like Article
Like

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

Last Updated : 16 Mar, 2018
Like Article
Save Article
Similar Reads