CIS 181 Intro to Comp Sci
Class 23, May 3, 2005

IMPORTANT DATES:

Fourth Project due: Tuesday May 17th

Final Exam Scheduled for Friday, May 20th, 10:30am-12:30pm


ASSIGNMENT:

Read D&D, in Chapter 8, pages 546-556

Exercise Due Thursday, May 5

The functionality implemented in the files that I provide include inserting a new node into the list at either the front or at the back of the list. For this assignment, you write a member function that will insert a node into a list at the spot where it belongs according to the alphabetical order of the list. This will involve (1) going through the list and determining what node the new node needs to be inserted AFTER (this will require walking two pointers down the list -- one following the other by one node -- the trailing pointer is the place where the new node is to be inserted after if the node that the leading pointer is pointing to is alphabetically beyond the word you are trying to insert); (2) actually doing the insertion of the new node. Always be careful to handle the boundary conditions -- e.g., when the new node is being inserted as the first node or last node in the list.

Again alter the driver program so that calls can be made to your new function, and show that the new function works as expected

 


TODAY'S TOPICS
 
  1. Finish up stacks, queues, trees (binary)
  2. const (constant) obects and const member functions
  3. More classes -- overloading constructors, constant member functions. Overloaded constructors are another way of separating use from implementation.
    A case study: exercise 7.7 in D&D

    Create a Date class with the following capabilities:

    See the files: $CLASSHOME/examples/date.h, $CLASSHOME/examples/date.cc, $CLASSHOME/examples/22-date.cc

    Some points to look for in the example:

  4. embedded classes -- see figure 7.6-- especially initialization of embedded classes in constructor