Question
You are given the implementation of a method - transfer(S,T) - as follows: static void transfer(Stack S, Stack T) { while (!S.isEmpty()) { T.push(S.pop()); }
You are given the implementation of a method - transfer(S,T) - as follows:
static
What does this function do ?
A. Transfers all elements from stack S onto stack T , so that the element at the top of S is the rst to be inserted onto T , and the element at the bottom of S ends up at the top of T
B. Transfers all elements from stack S onto stack T, so that the element that starts at the top of S is the last to be inserted onto T , and the element at the bottom of S ends up at the bottom of T
C. Is equivalent to T=S
D. The code will throw error
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started