CS 223 - Spring 2017. 4/3

Welcome to CS 223!

Larry Wall Quote of the day

Being an adult isn't about being grown up--it's about realizing you need to grow up.

Logical problem of the day

//version 1
int main(int argc, char *argv[])
  bool avl = true;
  if(avl) {
    double x = 123;

//version 2
int main(int argc, char *argv[])
  bool avl = true;
    double x = 123;
Is there a meaningful difference between version 1 and version 2?

Lecture 18: HW6 + Data Structures: graphs, heaps


  • 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 5 - Revision

    Problem set 5 revision

  • Add balanced tree option to hw5, using -avl flag.
  • See /c/cs223/hw5/Cloudavlx
  • See AVL Trees AVLtree.h AVLtree.c AVLtree.output
  • Here is one way to do it: (how I did it)

    Assignment 6

    Problem set 6

  • Per piazza: Can the size of the heap ever be larger than the size of the dictionary?

    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: 2-3 trees
  • Aspnes: red black trees
  • Aspnes: B trees