(Latest Revision: 04/22/2002)
Queue Information for CS2
- Definition of the queue data type
- Organization -- First-In, First-Out
- Elements -- any given homogeneous set
- Operations
- constructor(s)
- destructor(s)
- bool QueueIsEmpty()
- void QueueInsert(queueItemType NewItem, bool& Success)
- void QueueDelete(bool& Success)
- void QueueDelete(queueItemType& QueueFront, bool& Success)
- void GetQueueFront(queueItemType& QueueFront, bool& Success)
- Applications of the queue data type
- Ready queue in an OS
- Resource queues -- e.g. student registration system
- Simulations -- e.g. traffic, airport, bank
- Radix Sort
- breadth-first search
- Implementations of the queue data type
- array-based implementation
- pointer-based implementation
- "as-a-list" implementations
- Pro's and Con's of different implementations
- array-based implementation
- PRO: simple code
- PRO: all operations are O(1)
- CON: static allocation
- pointer-based implementation
- PRO: dynamic memory allocation
- PRO: most operations are O(1)
- CON: destructor is O(N)
- CON: extra memory required for each element.
- "as-a-list" implementations
- PRO: extremely easy to program
- PRO: if done a certain way, can be as efficient as coding
"from scratch." -- take care to make both insertion
and deletion efficient.
- PRO: can be done with an array-based list or with a
pointer-based list.