[Home]

CS 223 - Spring 2017. 4/19

Welcome to CS 223!

Logical problem of the day

lp0419.c
int main()
{
  int n;
  printf("Enter a number:\n");
  scanf("%d\n",n);
  
  printf("You entered %d \n",n);
  return 0;
}
What is going on here?

lp0419b.c

#define PrintInt(expr) printf("%s : %d\n",#expr,(expr))
int FiveTimes(int a)
{
  int t;
  t = a<<2 + a;
  return t;
}

int main()
{
  int a = 1, b = 2,c = 3;
  PrintInt(FiveTimes(a));
  PrintInt(FiveTimes(b));
  PrintInt(FiveTimes(c));
  return 0;
}
What is going on here? (See Aspnes: macros for explanation of "#expr" - this is a useful trick!)

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 3-5pm. (today)

  • Question about ETA for hw grades: hw4 grades have been posted. resubmission deadline Monday May 1st at midnight.

  • Float review session: Friday 3 - 5pm, Digital Humanities Lab

  • Women in Tech talk: Jen Bourney, Google Thursday Noon, 25 Science Park, Room 125.

    Assignment 7

    Problem set 7 Revised hw7 (new pseudo code)

    video of another solution DO NOT IMPLEMENT THIS.

    We have also released a program /c/cs223/hw7/Wordsdemo which prints out copious intermediate results when given the debug flag.

    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.)

    Change in specification: (a) given the following code, what is the output and why?

    Review topics

    Dynamic Programming

  • Aspnes: Dynamic Programming
  • fib.c after Aspnes. Uses array instead of hash table. Issue with fib2(45). See revised code in fib2.c
  • fib.py Python version with memoization.
  • Minimum coin changing problem Note: greedy algorithm is not always optimal. Recursive solution: mcc.c with command line args: mccargs.c Dynamic programming solution: mccdp.c with command line args: mccdpargs.c (Knapsack problem, related to bin packing from hw2.)
  • lis.c lis_test.c longest increasing subsequence, from Aspnes.

    Lecture 23: Guest Lecture: Facebook


    [Home]