143k views
3 votes
Suppose that a program performs an intermixed sequence of (stack) push and pop operations. The push operations put the integers 0 through 9 in order onto the stack; the pop operations print out the return values. Which of the following sequence(s) could not occur?

a. 4321098765
b. 2143658790
c. 0465381729
d. 4687532901

User Dogiordano
by
4.0k points

1 Answer

4 votes

Answer:

c and d.

c. 0465381729

d. 4687532901

Step-by-step explanation:

Once an item has been stacked on top of another item, there

is no way to pop them in a different order.

User HariKarthick
by
5.3k points