301 views
0 votes
0 votes

Consider the following code to reverse the elements of the Queue
image:Q14_image.JPG
Which of the following is a correct sequence of A,B,C?

  1.   temp=dequeue(Queue);
    enqueue(temp,Queue);
    Reverse(Queue);
  2.  Reverse(dequeue(Queue));
    temp=dequeue(Queue); 
    enqueue(temp,Queue);
  3.   temp=dequeue(Queue);
    Reverse(Queue);
    enqueue(temp,Queue);

2 Answers

1 votes
1 votes
Right ans is Option 3
Option 2 is wrong because in reverse(dequeue(queue)) we are passing a single data not  queue

No related questions found