Queue

The Queue Class is privately derived from SequentialList. It can implement either a first-in / first-out (FIFO) queue, or a last-in / first-out (LIFO) queue.

Class Queue

Method

Description

Pointer getHead ()

return and remove the first element in the queue (return zero if empty)

Pointer getTail ()

return and remove the last element in the queue (return zero if empty)

void initialize ()

remove all elements from the queue

void putHead (Pointer p)

add the element p to the beginning of the queue

void putTail (Pointer p)

add the element p to the end of the queue

int size ()

return the number of elments in the queue