0 0 votes Consider the following code to reverse the elements of the Queue Which of the following is a correct sequence of A,B,C? temp=dequeue(Queue); enqueue(temp,Queue); Reverse(Queue); Reverse(dequeue(Queue)); temp=dequeue(Queue); enqueue(temp,Queue); temp=dequeue(Queue); Reverse(Queue); enqueue(temp,Queue); Data Structures + – A_i_$_h 695 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 0 0 votes option 3 mayur ganatra 1 answered Jun 26, 2017 • selected Jun 27, 2017 by A_i_$_h mayur ganatra 1 comment Share Follow See all 2 Comments 2 2 Comments reply A_i_$_h commented Jun 27, 2017 reply Follow flag why option 2 is not right, can u explain? 0 0 replyShare mayur ganatra 1 commented Jun 27, 2017 reply Follow flag just dry run the 2nd option as i have done. you will find it why it is wrong.. 0 0 replyShare Please log in or register to add a comment.
1 1 vote Right ans is Option 3 Option 2 is wrong because in reverse(dequeue(queue)) we are passing a single data not queue Ankit001 answered Jul 13, 2017 Ankit001 comment Share Follow See 1 comment 1 1 comment reply A_i_$_h commented Jul 14, 2017 reply Follow flag thank you :) 0 0 replyShare Please log in or register to add a comment.