(Solved):In C++, transfer elements from stack S1 to stack S2 so that the elements from S2 are in the same order as in S1: a) Using one additional stack. b) Using no additional stack but some additional nona… View Answer…

 

Question

In C++, transfer elements from stack S1 to stack S2 so that the elements from S2 are in the same order as in S1:

a) Using one additional stack.

b) Using no additional stack but some additional nonarray variables.

 

EXPERT ANSWER

First method is simple. We first migrate elements from the first stack to a spare stack, which will have elements in reverse order. Then, move them to second stack, which will have the

Scroll to top