Assume that $\text{S}$ is a stack and $\text{Q1}$ and $\text{Q2}$ are two Queues which support the Enqueue and Dequeue operations. Consider the following pseudo code for implementing the Pop and Push operation on $\text{S}$.
Push(S,x)
A(Q2,x)
while(Q1 not empty)
B(Q2,C(Q1));
Swap(Q1,Q2)
Pop(S)
return(D(Q1))
Which of the following options for the functions $\text{A, B, C}$, and $\text{D}$ would correspond to correctly implementing the Push and Pop operations on the stack $\text{S}$?
- $\text{A, B}$ - Enqueue $\text{C, D}$ - Dequeue
- $\text{A, C}$ - Enqueue $\text{B, D}$ - Dequeue
- $\text{A, C}$ - Dequeue $\text{B, D}$- Enqueue
- $\text{A, D}$ - Enqueue $\text{B, C}$ - Dequeue