Two stacks

Report a typo

stacks

You are given two stacks: stack X and stack Y. Stack X initially contains elements a, b, and c in that order, with a on top, while stack Y is empty. You can perform two operations:

  1. Pop an element from stack X and either print it immediately or push it onto stack Y.

  2. Pop an element from stack Y and print it.

Determine which of the following sequences of elements cannot be printed by popping elements from stack X and stack Y according to the given rules.

Hint: Try each option one by one with pen and paper to see which of the given sequences is not possible.

Select one option from the list
___

Create a free account to access the full topic