536 views
1 votes
1 votes
Consider a standard Circular Queue ‘q’ implementation (which has the same condition for Queue Full and Queue Empty) whose size is 11 and the elements of the queue are q[1], q[2], ……, q[10]. The front and rear pointer are initialized to point at q[2]. In which position will the ninth element be added?

1 Answer

Best answer
1 votes
1 votes
Ans: q[0]

In circular queue, $enqueue$ operation takes place as - first rear is incremented then element is inserted. So first element will be inserted at $q[3]$ and so on. Hence the 9th element will be inserted at $q[0]$.

Related questions

0 votes
0 votes
1 answer
1
Souvik33 asked Nov 2, 2022
864 views
Which data structure would be most appropriate to implement a collection of values with the following 3 characteristicsSingly link list with head and tail pointerDoubly l...
0 votes
0 votes
1 answer
3
kickassakash asked Jul 4, 2023
420 views
I have specific doubt on this question and I’ve tried to explain that in the picture ,If anyone can explain it then it’ll be of great help. according to sachin sir th...
0 votes
0 votes
1 answer
4
Souvik33 asked Apr 2, 2023
428 views
There are Insert and Retrieve_Max operations on a set {}. for n such operations what is the time complexity of the efficient algorithm possible?$n^{2}$nlogn n logn