33 votes 33 votes 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 $\text{1, 2, 3, 4, 5}$ in that order? $\text{3, 4, 5, 1, 2}$ $\text{3, 4, 5, 2, 1}$ $\text{1, 5, 2, 3, 4}$ $\text{5, 4, 3, 1, 2}$ DS gate1994 data-structures stack normal + – Kathleen asked Oct 4, 2014 recategorized Apr 25, 2021 by Lakshman Bhaiya Kathleen 33.1k views answer comment Share Follow See 1 comment See all 1 1 comment reply Kiyoshi commented May 3, 2021 reply Follow Share Similar concept : https://gateoverflow.in/3695/gate-it-2004-question-52 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes Push 1 Push 2 Push 3 Pop 3. (3) Push 4 Pop 4. (4) Push 5 Pop 5. (5) Pop 2. (2) Pop 1 .(1) Soo the order is 3,4,5,2,1 SUBRATO KUMAR answered Sep 9, 2019 SUBRATO KUMAR comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes we can do it inspection very easily,how it can be efficiently using programming ? s_dr_13 answered Jul 16, 2020 s_dr_13 comment Share Follow See all 0 reply Please log in or register to add a comment.