Suppose you are given a stack S1, [3, 5, 1, 6, 7, 9] (represented as top -> [3, 5, 1, 6, 7, 9] <- bottom), and you pop a
Posted: Thu Jun 02, 2022 8:13 am
Suppose you are given a stack S1, [3, 5, 1, 6, 7, 9]
(represented as top -> [3, 5, 1, 6, 7, 9] <- bottom), and you
pop all of its elements and transfer them to S2 and then call
pop() on S2 twice. What would be the result if peek() is
called on S2 next?
(represented as top -> [3, 5, 1, 6, 7, 9] <- bottom), and you
pop all of its elements and transfer them to S2 and then call
pop() on S2 twice. What would be the result if peek() is
called on S2 next?