\manpage {b\_queue} {E} {Bounded Queues}
 
\definition
An instance $Q$ of the parameterized data type \name\ is a queue
(see section \ref{Queues}) of bounded size.
 
\creation Q
 
\create {(int\ n)}
   { creates an instance \var\ of type \name\ that can hold up to $n$
           elements.  \var\ is initialized with the empty queue. }
 
 
\operations 2 5
 
\op  E top {()}
           {  returns the front element of \var.\\
         \precond $Q$ is not empty. }
 
 
\op  E pop {()}
           {  deletes and returns the front element of \var.\\
         \precond $Q$ is not empty. }
 
 
\op  void append {(E\&\ x)}
           {  appends $x$ to the rear end of \var.\\
	  \precond $Q$.size()$ < n$. }
 
 
\op  void clear {()}
           {  makes \var\ the empty queue. }
 
 
\op  int size {()}
           {  returns the size of \var. }
 
 
\op  bool empty {()}
           {  returns true if \var\ is empty, false otherwise. }
 
 
\implementation
Bounded queues are implemented by circular arrays. All operations take 
time $O(1)$. The space requirement is $O(n)$.
 
