2,156 views
1 1 vote

Suppose a circular queue of capacity (n – 1) elements is implemented with an array of n elements.

Now, in this queue what will be condition for FULL and EMPTY?

Full:(REAR+1)%n== FRONT

       (or)

      (FRONT+1)%n==REAR

       (or)

     FRONT==REAR

      

 Empty:   FRONT==REAR

       (or)

              REAR== FRONT

--------------------------------------------------------------------------------------------------

I think FRONT== REAR and REAR==FRONT means same, So, both will give correct result in case of Empty . It is a checking if both pointer pointing same or not. But for FULL it will not give correct result. because, Rear cannot go same location as Front locating . But Front pointer can come and point same location as rear.

So, in case of Full, Rear point array that must be array index more than Front

Am I right?

Then what equation will valid?

 

 

Please log in or register to answer this question.

Position:
Show:

Related questions

4 4 votes
1 answers 1 answer
24.4k
24.4k views
hacker16 asked Nov 14, 2017
24,389 views
In circular singly linked list, insertion of node requires modification of how many pointers?1 pointers2 pointers3 pointers 4 pointers
0 0 votes
2 2 answers
2.1k
2.1k views
5 5 votes
2 2 answers
245
245 views
GO Classes asked Jul 3
245 views
A singly linked list is:$\texttt{5 - 8 - 20 - NULL}$A new node $\texttt{​newP}$ contains data $9$. Pointer $\texttt{​prevP}$ points to the node containing $8$.The inserti...
0 0 votes
1 1 answer
29.0k
29.0k views
Lakshman Bhaiya asked Oct 17, 2018
28,984 views
In a linked list with $n$ nodes, the time taken to insert an element after an elementpointed by some pointer is:$(A) O(1)$$(B) O(logn)$$(C) O(n)$$(D) O(nlogn)$