Choose correct output for the following sequence of operations. push(5) push(8) pop() push(2) push(5) pop() pop() pop() push(1) pop() push (6) pop() code example
Example: stack operations, if executed on an initially empty stack? push(5), push(3), pop(), push(2), push(8), pop(), pop(), push(9), push(1), pop(), push(7), push(6), pop(), pop(), push(4), pop(), pop().
5
5 3
5
5 2
5 2 8
5 2
5
5 9
5 9 1
5 9
5 9 7
5 9 7 6
5 9 7
5 9
5 9 4
5 9
5