A stack is initially empty, then the following commands are performed: push 5, push 7, pop, push 10, push 5, pop , which of the following is the correct stack after those commands (assume the top of the stack is on the left)?

a. 10 7 8 5 9
b. 10 8 5
c. 8 5 9
d. 8 5

Respuesta :

Answer:

The answer is "5, 10".

Explanation:

In this question values are different that's why all choice was wrong, it correct solution can be defined as follows:

In the stack, we use the "push and pop" method that works as follows:

  • Push is used to inserting the value into the stack.
  • Pop is used for deleting the value from the stack.
Ver imagen codiepienagoya
ACCESS MORE
EDU ACCESS