Watson Data Structures Tutorial


Home
Labs
Tutorials
Known Bugs
Schedule
Archive
Members
Contact Information

Layout of the Stack Data Structure

Below is a screenshot of the Watson Data Structures Lab about stacks. As you can see, the major sections of the lab are numbered and explained below the image.

  1. 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.
  2. Data Set - Contains all the data or information which may be used within an activity.
  3. Stack - A sequence of items, all of the same type, that can only be accessed from one end.
  4. Top Pointer - A pointer to the current or top element on the stack.
  5. Temp Variable - A variable used to temporarily store a value from the data set.
  6. Pop Button - Removes the top item from the stack and return its value. If the stack is empty, raise an "Stack Empty" exception.
  7. Push Button - Puts an item to the top of the stack.

All operations on a stack are relative to the top of the stack; no other items in the stack may be manipulated until they become the top item. The animated figure below demonstrates how the top pointer works.

Stack Intro Activity

Below is a set of step-by-step instructions on how the example works.

  1. Click on the button labeled 'Activity'.
  2. Select the Stack Intro activity and click on the 'OK' button to begin the program.
  3. Click on the 'OK' after viewing the activity description for the stack intro exercise.
  4. Move the cursor to the 'Data Set' window over the button labeled '1st floor' and click. Then move your cursor to the 'Stack' window and click on the 'Push' button.
  5. Repeat step 4 for floors 2 through 7.
  6. Move the cursor over to the button labeled 'Pop' and click on it.
  7. Repeat step 5 for the 6th floor.
  8. Press any key on the keyboard to answer the questionnaire at the top of the screen.
  9. Choose one of the three choices listed.

<< Back

Back to Tutorials

Next >>



Home | Labs | Tutorials | Known Bugs | Schedule | Archive | Members | Contact Information

For problems or questions regarding this site or the labs, contact the Watson Project.
Last updated: 10/22/03.