Implement a method with signature transfer(S, T) that transfersall elements from stack S onto stack T , so that the element thatstarts at the top of S is the first to be inserted onto T , and theelement at the bottom of S ends up at the top of T.
stack S
1,2,3,4,5
stack T
5,4,3,2,1
Expert Answer
An answer will be send to you shortly. . . . .