Computer Science, asked by 258shruti, 1 month ago

An intermixed sequence of 10 push and 10 pop operations are performed on a stack. The pushes push the numbers 0 through 9 in order and the pop prints out the return value. Which of the following output sequence cannot occur with respect to the given scenario?​

Answers

Answered by ankitabareth200787
17

Answer:

IF the numbers are pushed in order, even with the pops occurring randomly, there are certain things that can never happen. Consider (b):

Push 0, 1, 2, 3, 4, pop 4, push 5, 6, pop 6, push 7, push 8, pop 8, pop 7, pop 5, pop 3, pop 2, push 9, pop 9.... You can't pop 0 because the one is in the way.

The same is true of the other incorrect answers.

Answered by babasumant007
48

Explanation:

An intermixed sequence of 10 push and 10 pop operations are performed on a stack. The pushes push the numbers 0 through 9 in order and the pop prints out the return value. Which of the following output sequences cannot occur with respect to the given scenario?

& Revisit

Choose the bes

O 0213765

O 543210

O

Similar questions