Question: Write a method called copyStack that accepts a stack of integers as a parameter and returns a copy of the original stack (i.e., a new
Write a method called copyStack that accepts a stack of integers as a parameter and returns a copy of the original stack (i.e., a new stack with the same values as the original, stored in the same order as the original). Your method should create the new stack and fill it up with the same values that are stored in the original stack. When your method is done executing, the original stack must be restored to its original state. Use one queue as auxiliary storage.
Step by Step Solution
3.48 Rating (165 Votes )
There are 3 Steps involved in it
public Stack copyStack Stack s s2 new ... View full answer
Get step-by-step solutions from verified subject matter experts
