0 votes 0 votes https://gateoverflow.in/3463/gate2007-it-30 WHAT IF THE QUEUE HAS FIXED LENGTH SAY CAN CONTAIN ONLY 4 ELEMENTS AND QUEUE IS COMPLETELY FILLED? THEN WHAT WILL BE THE ANSWER? eyeamgj asked Sep 19, 2018 eyeamgj 361 views answer comment Share Follow See all 7 Comments See all 7 7 Comments reply Verma Ashish commented Sep 19, 2018 reply Follow Share Why you think that the operations performed by function depend on length of queue? It is independent it reverses the order of elements in the Q.. 0 votes 0 votes eyeamgj commented Sep 19, 2018 reply Follow Share IN THE QUESTION WE HAVE QUEUE LIKE WHICH CAN CONTAIN ANY NUMBER OF ELEMENTS 1 2 3 4 AFTER GIVEN CODE IT WILL BE LIKE 4 3 2 1 NOW I AM ASKING IF WE HAVE QUEUE LIKE THAT AND THEN WE APPLY THE GIVEN CODE WHAT WILL BE THE OUTPUT STILL THE REVERSE ORDER BE THERE IN QUEUE?? 1 2 3 4 0 votes 0 votes Shaik Masthan commented Sep 19, 2018 reply Follow Share @eyeamgj note that it is in recursion.... therefore even it is full, it should be reversed. when array is bounded by size, queue turns into circular queue 0 votes 0 votes eyeamgj commented Sep 19, 2018 reply Follow Share how ?becz rear is at last of queue and we need to insert the elements which are take by i so how we came to starting position after deleting all elements 0 votes 0 votes Shaik Masthan commented Sep 19, 2018 reply Follow Share rear = (rear+1) mod size 0 votes 0 votes eyeamgj commented Sep 19, 2018 reply Follow Share ok in general we need to suppose circular queue if queue is empty and we need to do insertionn but all the avvailable space is on left side.... 0 votes 0 votes Shaik Masthan commented Sep 19, 2018 reply Follow Share if you are seeing it is circular, then there is no terms left and right. if you are not seeing it is a circular, then if you have free memory at left side, then need COMPACTION. ==> O(n) check this https://drive.google.com/open?id=1dx2OBqiH6lJwpSRLM-dYJ6YHg1Ub0Fv7 0 votes 0 votes Please log in or register to add a comment.