PPT Slide
Given a full Queue, where a client tries to enqueue an item . . .
- What should you have the Queue do?
- How do you know what it should do?
- Should it print out a message?
- Should it try to increase the Queue’s size?
- Should it not enqueue the item?
- Should it dequeue an item to make room for the new item?
What should you do? To put it simply, you don't know.
1. Your design/documentation for enqueue
should state a precondition:
/** PRE/POST: The queue is not full */
2. The code will let the exception propagate.