[Home]

CS 223 - Spring 2017. 2/6

Welcome to CS 223!

Logical problem of the day

lp0206.c
int main(){
  int n=1;
  printf("%d %d\n", n++, n++);
}
What happens above?

Lecture 7: Introduction to C: hw3 + structs, linked lists, hash tables

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.
  • Reminder to speaker: use the microphone in Davies.

  • Michael Ljung's presentation demonstrated Brook's Law: The Mythical Man Month.
  • Accenture Case Study for Healthcare.gov
  • Per piazza: hw1 grade reports have been emailed
    I have sent out the grade reports for hw1.
     
    Here are the statistics:
     
    Grade		Hours
    Max	36		31
    Min	0		0
    Avg	30.9		9.6
    Median	33		9
    Stdev	7.8		5.7
     
    The min and average data are not very meaningful.  Some hw's did not
    compile and some students neglected to include their total time in
    their log files -- or did not submit a log file.
     
    If your code did not compile, you should fix it and resubmit, without
    penalty.
     
    If you lost points otherwise, you too may resubmit and get 50%
    incremental credit.  For example, if you got 30/36 and you resubmit
    for 36/36, you will get an additional 3 points (36-30 * 50%).
     
    I will review this in class today as well.
     
    --SS
    
    p.s. I will post hw grades to classes v2 once the resubmit process concludes.
    
  • The trajectory of the course.

    Assignment 3

    Problem set 3
  • Piazza note about pointers
  • Private question from piazza:
      Why are struct elt and struct hash commented out in hash.h? If I want
      them to be available to both hash.c and Callme.c, shouldn't they be
      uncommented?  
    
    Callme.c should not reference struct elt or struct hash directly.
    Those are encapsulated in hash.c.
     
    I defined them as comments in hash.h so you can define them in hash.c
     
    --SS
    

    Lecture Starts Here

    Pointers

    Aspnes: Pointers

    structs

    Aspnes: structs

  • struct.c Basic date struct, and recursive person struct, with and without pointers and malloc.
  • You can use structs to make new data types. Here is a string data type that includes the length of the string.
  • myString.h
  • myString.c

    Linked Lists

    Aspnes: Linked Lists

    Structs are just fine for creating single data type instances, like strings. It is usually more interesting to create data structures that actually produce structures. The simplest structure is a linked list. We will later see more complex structures, like trees and graphs, which are variations on linked lists.

  • lists.c

    Hash Tables

    Aspnes: Hash Tables

  • Hash Functions:
  • exhash.c integer keys, linear probing
  • exhash2.c string keys, linear probing
  • examplehash.c integer keys, linear probing, dummy item for deletes
  • examplehash2.c string keys, linear probing, dummy item for deletes
  • hw3/hash.h
  • hw3/hashtest.c uses hash.h, string keys, linked lists
  • hw3/bighashtest.c uses hash.h,
    [Home]