| 
              
                
                  | Algorithm size() return (N − f + r) mod N
 |  
 
              
                
                  | Algorithm isEmpty() return (f = r)
 
 |  | 
              
                
                  | Algorithm enqueue(o) if size() = N − 1 then
 throw FullQueueException
 else
 Q[r] ← o
 r
                        ← (r + 1) mod N
 |  
 | 
              
                
                  | Algorithm dequeue() if isEmpty() then
 throw EmptyQueueException
 else
 o
                        ← Q[f]
 f
                        ← (f + 1) mod N
 return o
 |  |