CS 223 - Spring 2017. 4/10

Welcome to CS 223!

Larry Wall Quote of the day

By and large, I try not to do anything unless I have several reasons to do it. (But they don't all have to be good reasons.)

Logical problem of the day

#include <stdio.h>

#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = {23,34,12,17,204,99,16};

int main()
  int d;

  printf("TOTAL_ELEMENTS: %lu\n", TOTAL_ELEMENTS);  
  // version 1:
  for(d=-1;d <= (TOTAL_ELEMENTS-2);d++)
  // version 2:
  for(d=0;d < (TOTAL_ELEMENTS);d++)
  return 0;
The expected output of the above C program is to print the size of the array followed by the elements in the array. What is going on here?

Lecture 20: Data Structures: red black trees + Dynamic Programming


  • Office hours:
    The office hours are Sun/Tue/Thu 8-11 PM at Hillhouse 17 Rm 111.
  • My office hours this week are Wednesday 3-5pm.

  • The ta's have posted a poll on piazza to solicit topics for review sessions. Check it and fill it.

    Assignment 6

    Problem set 6

    Assignment 7

    Problem set 7

    Final Exam

    In class on Monday April 24th. Topics for final exam and Sample questions for final exam (from last year) (No 2-3, 2-4 trees, which are actually sub-types of B trees.)

    Lecture Starts Here

    Red Black Trees

  • Aspnes: red black trees
  • Red Black tree != AVL tree:
  • Red black trees. Introduction Animation C++ Implementation rb.cpp
  • C++

    B Trees

  • Data Structure Visualizations
  • Aspnes: B trees
  • https://en.wikipedia.org/wiki/B-tree
  • https://en.wikipedia.org/wiki/B+ tree

    Dynamic Programming

  • Aspnes: Dynamic Programming
  • fib.c after Aspnes. Uses array instead of hash table.
  • lis.c lis_test.c longest increasing subsequence, from Aspnes.