Final version of program #1 is due today.
Questions? Also, I'll be in the office from
about 12:30 to about 3:00.
Students have to get started on program #2.
Probably I can help by explaining recursion
and going over examples of recursive
algorithms to write a list forward or
backward.
Discussion of non-recursive and recursive versions
of "factorial" function.
Examine non-recursive and recursive versions of
in-order traversal of a BST. Show the
non-recursive first, and then the recursive. This
is good to indicate the power of recursion.
(Source: Stubbs and Webre)
Wednesday, September 27
Take Roll.
Announcement(s)
A copy of each of the course texts is now on
reserve in the Library. The books are
available for 2-hour checkout during the day,
and for overnight checkout after 4:00 pm.
Read your e-mail. I sent trouble reports to
some people about program #1. I need to talk
to some of you as soon as possible.
More Discussion of recursion
Recursive algorithms to write a list
backwards or forwards.
Hint for doing program #2: try to
write one recursive function
that does both the forwards
and backwards printing of the
series of characters.
How can you do that? Try putting
two print statements in the
function instead of one.
Experiment with where you put them.
Note: I made a mistake in class
and suggested that you use two
recursive calls in the function.
Use the hint above instead.
Friday, September 29
Take Roll.
Announcements
More Discussion of recursion
Discuss Activation Records and implementation
of recursion. Use the evaluation of
factorials as the working example.
Write out a "tree" to show how inefficient it
is to calculate n choose k with recursion.
The compiler command option for naming the
executable file: (g++ -o decode decode.cpp)
Discuss compiling/debugging with jove
How to execute the compiler "inside" jove:
(C-u, C-x, C-e)
How to break out of jove to a sub-shell whilst
"saving your place": (M-s)
Testing the program while in the sub-shell.
How to break out of the sub-shell and return
to "your place" in jove: (exit)
We can talk about arrays, structs, arrays of
structs, structs containing arrays, etc.
Point out locations in "General Info" section of
web space where there is information on compiling,
setting up www browsing, and other things ...
Point out that there are C++ strings and C strings.
If you want to use C++ strings, use:
#include <string>
If you want to use C strings, then use one or both of:
#include <cstring>
#include <string.h>
Discuss virtues of abstract data typing and modular code.