[Home]
CS 223 - Spring 2017. 4/5
Welcome to CS 223!
Larry Wall Quote of the day
I view a programming language as a place to be explored, like Disneyland.
Logical problem of the day
lp0405.c
int main(int argc, char **argv){
int a = 2 | 4 ;
int b = 010 | 0100 ;
if (a == b) {
printf("a: %d b: %d\n", a, b);
} else {
printf("a-b: %d\n", a - b);
}
}
What is going on here?
Lecture 19: HW6 + Data Structures: red black trees
Administrivia
Office hours:
The office hours are
Sun/Tue/Thu 8-11 PM at Hillhouse 17 Rm 111.
My office hours this week are Wednesday 4-5pm. (++)
Assignment 6
Problem set 6
Final Exam
In class on Monday April 24th.
Topics for final exam
and
Sample questions for final exam (from last year)
Lecture Starts Here
Binary Trees
Heaps and Graphs
heap visualization
heap.c
Aspnes: Heaps
Implement heaps as arrays. For zero-based arrays as in C, the
rule is that a node at position i has children at positions
2*i+1 and 2*i+2; in the other direction, a node at position i
has a parent at position (i-1)/2 (which rounds down in C).
Aspnes: Graphs
Aspnes: red black trees
Red black trees.
Introduction
Animation
C++ Implementation
rb.cpp
C++
- Mostly a superset of C. It is difficult, but not impossible,
to write legal C code that is not legal C++.
- Object oriented: classes, constructors (new, not
malloc), destructors,
encapsulation (private, protected, public),
inheritance, polymorphism, operator overloading.
- I/O streams
- Templates
- Exception handling
- Standard Library - better designed than C's.
Aspnes: 2-3 trees
Aspnes: B trees
[Home]