Latest Update: 04/25/2000


Week 11 Notes for CS 2500 -- Spring 2000
(this is draft material)

* Take roll 

* Schedule Highlights

* Prog #4 assignment is in the web space.  Be sure to use the
  subject line requested!

* Pass back Quiz #2 -- check my arithmetic

* There is grade information posted in web space.

* I may be away on Wednesday, May 3.  Class should meet that
  day in the Lab and work on program #4.  (The usual rules
  apply -- you may discuss the program, but not share actual
  C++ code.)

* We will discuss stacks this week.

* What is a stack?  In essence how does one use it?

* discussion of the role of the stack in program #4
  + what constitutes a prefix expresssion?

* The operations of our implementations:

   stackClass();  // default constructor
   bool StackIsEmpty() const;
   void Push(stackItemType NewItem, bool& Success);
   void Pop(bool& Success);
   void Pop(stackItemType& StackTop, bool& Success);
   void GetStackTop(stackItemType& StackTop, 
                    bool& Success) const;

* quick look at the design chart for program #4 -- this is
  merely a suggestion for how the design may be done -- you are
  not required to make your design resemble this one.

* The array-based implementation of a stack.

* The pointer-based implementation of a stack.

* implementing a stack with a list.

* comparison of stack implementations.

* Here is a (recursive) grammar for generating any prefix
  expression:

  1.  The symbol x is a prefix expression if x is any upper
      case letter.

  2.  If e and f are prefix expressions, then the following are
      also prefix expressions:

        +ef
	-ef
	*ef
	/ef

   Note: Here I mean by "prefix expression" just the kind of
   prefix expression that our assignment #4 program is supposed
   to be able to translate.

   Probably we can just state this fact this week and look at
   it in more detail next week.

   Anyway, we can use rules 1 and 2 to recursively generate
   lots of examples of prefix expressions:

   A
   +AB
   / +AB D
   / +AB -CD
   * /+ABD /+XY-WZ

   Note: I inserted extra spaces in the last few to make it
   more clear how the rules 2 was used.  Really, the spaces are
   not allowed to be there.