AP Computer Science Workshop


AP Classes: apqueue

 
Code Effect
apqueue<int> q; constructs an empty queue of ints
q = otherqueue; assignment works
 
q.front(); returns copy of first element
q.isEmpty(); returns true if q is empty, false otherwise
q.length(); returns number of elements in queue
 
q.enqueue(item); inserts item onto the queue
q.dequeue(); removes front element from queue
q.dequeue(item); removes front element and returns it in item
 
q.makeEmpty(); makes queue empty

Previous slide Mark Stehlik, Carnegie Mellon University Next slide