2. Suppose the numbers 0, 1, 2, ..., 9 were pushed onto a stack in that order, but that pops occurred at random points b
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
2. Suppose the numbers 0, 1, 2, ..., 9 were pushed onto a stack in that order, but that pops occurred at random points b
2. Suppose the numbers 0, 1, 2, ..., 9 were pushed onto a stack in that order, but that pops occurred at random points between the various pushes. The following is a valid sequence in which the values in the stack could have been popped: 3, 2, 6, 5, 7, 4, 1, 0, 9,8 Explain why it is not possible that 3, 2, 6, 4, 7, 5, 1, 0,9, 8 is a valid sequence in which the values could have been popped off the stack.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!