ANSWER SHOULD BE D!!
Here’s how: Let’s assume a Circular Queue of size-4 having elements a,b,c,d
Now assume front is pointing to ‘a’ and rear is pointing to ‘d’, then if we dequeue then a will be dequeued and again then b will be dequeued.
So now circular queue will look like this,
Where Front is pointing to c and rear is pointing to d.
Now if we enqueue f and g then it will change like this
Where front is pointing to c and rear is pointing to g.
Now to implement via Singly linked list we really don’t need any extra thing rather than front pointing to front node of the list and rear pointing to last and rear’s next pointing to null.
First we will have a->b->c->d ,Front =a and Rear=d.
then we will do 2 dequeue then it will be just c->d, Front at c and Rear at d.
then if we do 2 enqueue then c->d->f->g.
Front at c and rear at g.
So Simply L.L code will look like this to Implement Circular Queue.
Enqueue Via L.L: Dequeue Via L.L:
Rear->next=New; Temp=front;
New->next=Null; Front=Front->next;
Rear=new; Free(temp);
So Rear does not require to point to Front and Front Does not require to point to Rear, SO ANSWER SHOULD BE D!!