Lecture Topics
(prior to midterm)
Last Modified:
Tue Dec 16 09:50:32 1997
See also the course syllabus
for a general outline of what will be covered each week.
Sep 2: course introduction
Introduction to Computer Science II
with Intensive C
Programming Abstraction (in C)
algorithms + data = programming
software principles (programming discipline)
algorithms (design, implementation, analysis)
data structures (abstract data types: what, advantages)
quiz/questionaire
first look at a C program
overall program structure
/* program comments */
#includes
#defines
function prototypes
int main(){
}
implementation of other functions
types in C
basic: [char], int, [float], double, [void])
user-defined (bool, string, ... )
variables
declaration
naming
Sep 4: working with variables
declaration--where?
initialization/assignment
input/output [printf, simpio.h]
operators
type conversions
shorthand assignment
statements (while, for, if, switch, etc)
programming idioms
functions
basics
function prototypes (and comments)
top down design
compiling with gccx and make (read FAQs)
Sep 9: functions
calendar.c
top-down design, bottom-up implementation
the nitty gritty of writing your own
more about printf
Sep 11: user-defined types (and typedef)
enum
struct
records
array
pointers
Sep 16: more about pointers
memory model
"call by reference"
arrays & pointers
memory layout
arrays as arguments to functions
pointer arithmetic
effective and allocated size
Sep 18: libraries
dynamic allocation
important differences between arrays and pointers
pointer array
auto memory allocation no yes
is lvalue yes no
return from function yes no
good interface
unified, simple, sufficient, general, stable
client code | interface | implementation
prog.c | lib.h | lib.c
Sep 23: random.h / random.c
strings in C
string.h
strlib.h
Sep 25: graphics.h (page 209 in text)
turtle.h
basic outline for recursion
1) solve if one of easy cases
if not an easy case, then
2) decompose into one or more "smaller" problems of the same
type
3) solve the "smaller" pieces
4) combine results from "smaller" pieces into solution to
original problem
** "smaller" means closer to base cases
examples
fund raising (pyramid type scheme)
factorial
fibonacci
Sep 30: more recursion
fibonacci
string functions
Towers of Hanoi
Oct 2: recursion
exponentiation
binary search
i/o in C
FILE*
printf(), scanf(), and cousins
program arguments
Oct 7: searching, sorting and efficiency of algorithms
linear search
binary search
selection sort
big O notation
Oct 9: sorting
merge sort
quick sort
insertion sort
Oct 14: no class
Oct 16: Abstact Data Types: what, why, how
stacks (first example of ADT)
interface
using stacks (parenthesis matching)
Oct 21: Implementation of a stack
Review for midterm
Oct 23: Midterm Exam in class