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.
A stack's operational order limits the permutations that can be generated. Systematically tracing these operations reveals the valid sequence: (B), (D), (E), (A), (C).