Question:

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?
(A) 2
(B) 3
(C) 1
(D) 4
(E) 5
Choose the correct answer from the options given below:

Show Hint

Ensure you follow the LIFO property of stacks and Not all permutations are achievable with stack operations.
Updated On: Dec 29, 2024
  • (B), (D), (E), (A), (C)
  • (B), (D), (A), (E), (C)
  • (A), (D), (B), (C), (E)
  • (E), (D), (C), (A), (B)
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

The order of operations in a stack allows only certain permutations to be generated. By tracing the stack operations systematically, the valid sequence is: (B), (D), (E), (A), (C).
Was this answer helpful?
0
0

Questions Asked in CUET PG exam

View More Questions