(Latest Revision: 03/04/2002)
Week 04 Notes for CS 2500, Section 001 -- Spring 2002
CS 2500, Section 001, Tuesday, March 05, 2002
- Look at Upcoming Schedule
- Class starts at 09:40. I take roll at 09:50
- Announcement(s)
- The final version of program #1 is due before midnight Tuesday,
Mar 5
- Program #2 is due next week, on Thursday, Mar 14
- Quiz coming up next week, on Thursday, Mar 14
- We finish chapter 2 (recursion) in Carrano this week, and read
about C++ in the appendix.
- In Andersen we read about files.
- I will be out of town on Thursday. Prof Lamie will substitute.
-
- Finish up discussion of recursion: Write out a "tree" to show how
inefficient it is to calculate (n choose k) with recursion. Also look
at programs nChoose?.cpp. Run them out of the Examples directory to
illustrate how much extra work it can take to compute (n choose k) with
poor use of recursion.
- Discussion of new programming assignment: Asg #02
- Go over the assignment
- Discuss possible jobs to assign to functions: sort, minLoc, swap.
- Run the program to illustrate how it behaves when reading from the
keyboard and also when reading from files via redirection of
standard input. Reading from files illustrates how I do my
testing of the program.
-
-
CS 2500, Section 001, Thursday, March 07, 2001
- Look at Upcoming Schedule
- Class starts at 09:40. I take roll at 09:50
- Announcement(s)
- Discuss testing requirements for program #2 -- zero length list --
length one and length two -- max length list -- descending order --
increasing order -- random order --
- Discuss the "Four Questions for Constructing Recursive Solutions"
- How can you define the problem in terms of a smaller problem of
the same type?
- How does each recursive call diminish the size of the problem?
- What instance of the problem can serve as the base case?
- As the problem size diminishes, will you reach the base case?
-
- Look at the
data structures talk
- Discuss virtues of abstract data typing and modular code.
- Easier to design correctly
- Easier to change implementations
- protects integrity of data from users
- Easier to re-use code
- Discuss structs, classes, arrays of structs, structs containing arrays,
etc.
- Consider the array-based list class (files ListA.h, ListA.cpp,
useList.cpp) as an example of a struct containing an array. Note that
the element type can also be a complex data structure.