implementation of a queue using a circular array
        Posted  
        
            by matin1234
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by matin1234
        
        
        
        Published on 2010-06-05T15:58:24Z
        Indexed on 
            2010/06/05
            16:02 UTC
        
        
        Read the original article
        Hit count: 286
        
java
|data-structures
Hi I have found these algorithms in the internet but I can not understand that why in the enqueue method we compare size with N-1??? please help me thanks!!
Algorithm size():
return (N-f+r)mod N
Algorithm enqueue(e):
if size()=N-1 then
   throw a FullQueueException
Q[r]<---e
r<----(r+1)mod N
© Stack Overflow or respective owner