The George Washington University
School of Engineering and Applied Science
Department of Computer Science
CSci 131 -- Data Structures
Lab #7
For labs meeting the week of Oct. 10, 2000

  1. Implement the body of the generic stack package from pages 294-295. You can save some typing if you start with a renamed copy of the generic queue package from pages 289-290.
  2. Now write an algorithm and then a program that reads, into a string, a line containing a sequence of letters and digits. Somewhere in the sequence, there may be a '#' character that effectively divides the sequence in two parts. The program will examine the string, character by character, and use a stack to determine whether the first part of the sequence is identical to the mirror image of the second part. QuIcK123#321KcIuQ is such a sequence. This is a special case of a palindrome.
NOTE: Understanding the data structure of the stack and queue packages will, in fact, require, understanding Section 6.1. Even though the rest of Chapter 6 will not be a part of this course, you will need to read at least 6.1 and 6.2. Prof. Feldman apologizes for forgetting the dependency of Chapter 7 on Chapter 6.