0 votes 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); A_i_$_h asked Jun 23, 2017 A_i_$_h 301 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 0 votes 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 See all 2 2 Comments reply A_i_$_h commented Jun 27, 2017 reply Follow Share why option 2 is not right, can u explain? 0 votes 0 votes mayur ganatra 1 commented Jun 27, 2017 reply Follow Share just dry run the 2nd option as i have done. you will find it why it is wrong.. 0 votes 0 votes Please log in or register to add a comment.
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 Ankit001 answered Jul 13, 2017 Ankit001 comment Share Follow See 1 comment See all 1 1 comment reply A_i_$_h commented Jul 14, 2017 reply Follow Share thank you :) 0 votes 0 votes Please log in or register to add a comment.