26-CS107-Midterm

26-CS107-Midterm - CS107 Spring 2007 Handout 26 May 9, 2007...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CS107 Handout 26 Spring 2007 May 9, 2007 CS107 Midterm Exam This is an open-note exam. You can refer to any course handouts, handwritten lecture notes, and printouts of any code relevant to a CS107 assignment. You may not use any laptops, cell phones, or handheld devices of any sort. Those taking the exam remotely should phone in if they have questions. Once you’re done, fax the exam to Stanford, but hold on to the original until you get the graded fax copy back. Cell phone is 415-205-2242, and fax number is 415-358-4911 . Good luck! leland username: _____________________ Last Name: _____________________ First Name: _____________________ I accept the letter and spirit of the honor code. I’ve neither given nor received aid on this exam. I promise to write as neatly as possible. (signed) __________________________________________________________ Score Grader 1. Color Theory (15) ______ ______ 2. Packing Packets (15) ______ ______ 3. Python (15) ______ ______ Total (15) ______ ______
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 vector.h typedef int (*VectorCompareFunction)(const void *elemAddr1, const void *elemAddr2); typedef void (*VectorMapFunction)(void *elemAddr, void *auxData); typedef void (*VectorFreeFunction)(void *elemAddr); typedef struct { // implementation specific } vector; void VectorNew(vector *v, int elemSize, VectorFreeFunction freefn, int initialAllocation); void VectorDispose(vector *v); int VectorLength(vector *v); void *VectorNth(vector *v, int position); void VectorInsert(vector *v, const void *elemAddr, int position); void VectorAppend(vector *v, const void *elemAddr); void VectorReplace(vector *v, const void *elemAddr, int position); void VectorDelete(vector *v, int position); int VectorSearch(vector *v, const void *key, VectorCompareFunction searchfn, int startIndex, bool isSorted); void VectorSort(vector *v, VectorCompareFunction comparefn); void VectorMap(vector *v, VectorMapFunction mapfn, void *auxData); hashset.h typedef int (*HashSetHashFunction)(const void *elemAddr, int numBuckets); typedef int (*HashSetCompareFunction)(const void *elemAddr1, const void *elemAddr2); typedef void (*HashSetMapFunction)(void *elemAddr, void *auxData); typedef void (*HashSetFreeFunction)(void *elemAddr); typedef struct { // implementation specific } hashset; void HashSetNew(hashset *h, int elemSize, int numBuckets, HashSetHashFunction hashfn, HashSetCompareFunction comparefn, HashSetFreeFunction freefn); void HashSetDispose(hashset *h); int HashSetCount(hashset *h); void HashSetEnter(hashset *h, const void *elemAddr); void *HashSetLookup(hashset *h, const void *elemAddr); void HashSetMap(hashset *h, HashSetMapFunction mapfn, void *auxData); tear me out
Background image of page 2
3 Problem 1: Color Theory (15 points; 5, 5, and 5) Consider the following struct definitions: typedef struct palette { short *lavender; char indigo[4]; struct palette *peach[2]; } palette; static palette **swatch(palette *ecru, int mint);
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/14/2010 for the course CS 107 taught by Professor Cain,g during the Spring '08 term at Stanford.

Page1 / 13

26-CS107-Midterm - CS107 Spring 2007 Handout 26 May 9, 2007...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online