






| |
Layout of the Queue Data Structure
Below is a screenshot of the Watson Data Structures Lab about queues. As you can
see, the major sections of the lab are numbered and explained below the
image.
- Watson Control
Bar - The common Watson control bar for all applications.
This bar contains all the functions to select an activity and get important
information about the lab.
- Data Set - Contains all the data or information which may be used within an activity.
- Temp Variable - A variable used to temporarily store a value from the data set.
- Queue - A sequence of items, all of the same type, that can only be accessed at two locations.
- Front Pointer - Returns the value of the front item in
the queue but does not remove this item; if the queue is empty, raise a "Queue
Empty" exception.
- Rear Pointer - Returns the value of the last item in the queue but does not remove this item.
- Dequeue Button - Removes the front item from the queue
and return its value; if the queue is empty, raise a "Queue Empty" exception.
- Enqueue Button - Adds an item to the rear of the queue.
All operations on a queue are relative to the front and rear pointers of the queue. No new items may be added to the queue without moving the rear pointer; no items in the queue may be removed without changing the front pointer.
The following animated figure demonstrates the behavior of the queue and the two
pointers.
Queue Intro Activity
Below is a set of step-by-step instructions on how the example works.
- Click on the button labeled 'Activity'.
- Select the Queue Intro activity and click on the 'OK' button to begin the program.
- Click on the 'OK' after viewing the activity description for the queue intro exercise.
- Move the cursor to the 'Data Set' window over the button labeled 'March' and click. Then move your cursor to the 'Queue' window and click on the 'Enqueue' button.
- Repeat step 4 for the months of April through July.
- Move the cursor over to the button labeled 'Dequeue' and click on it.
- Repeat step 5 for the months of April and May.
- Press any key on the keyboard to answer the questionnaire at the top of the screen.
- Choose one of the three choices listed.
|