The input stream of a stack is a list of all the elements we pushed onto the stack, in the order that we pushed them. The input stream is ABCDEFGHIJKLM.
The output stream is a list of all the elements that are popped off the stack, in the order that they are popped off.
a. What is the output stream of ABCDEFGHIJKLM?
b. If the input stream is ZYXWVUTSR, create a sequence of pushes and pops such that the output stream is YXVUWZSRT.
c. If the input stream is ZYXW, how many different output streams can be created?

Solved
Show answers

Ask an AI advisor a question