724 views
1 votes
1 votes
A queue is implemented using two stack A and B. Consider the following code void enqueue(int value)

{

While (!B.is Empty())

A.push(B.Pop());

A. push (value);

}

int dequeue ()

{

While (!A.is Empty())

{X}

return B.Pop();

}

if enqueue is implemented using two stacks A & B With operation Push ,Pop and is empty of stacks then find the missing statement X to implement dequeue operation of the queue .

A)

A.Push(B.Pop());

B)

B.Push(A.Pop());

C)

A.Pop(B. Push ());

D)

B.Pop(A. Push ());

what is difference between option b,d???

Please log in or register to answer this question.

No related questions found