CS 201 - 11/17/14 Count 33 Max 100 Min 28 Ave 82.45 Median 88 St.Dev 18.80 90+ 16 80's 5 70's 4 60's 5 50's 1 40's 1 30's 0 20's 1 ======================================= Re-hashing after re-sizing int main ( ) { httype* ht; resize (&ht, newSizeVal); } void resize (httype ** htp, int nsv) { // allocate new ht of new size httype* htDeRef = *htp; httype* temp; temp = malloc(....); // set up array of linked list pointers that // are all NULL(lists are empty) // migrate the values forall values stored in htDeRef insert into temp // clear memory associated with htDeRef // set htp to the value of temp *htp = temp; } ----------------------------- Alternative approach int main ( ) { getInput (stdin); } void getInput(FILE* input ) { static httype* ht = NULL; static fileNameCollection = NULL; if (ht == NULL) initialize (ht); if ( command == 'r') { ... ht = resize2 (ht, newSizeVal); ...} if ( command == 'f') {... getInput (nextFile); ...} } httype* resize2 (httype* htcopy, int nsv) { // allocate new ht of new size httype* temp; temp = malloc(....); // set up array of linked list pointers that // are all NULL(lists are empty) // migrate the values forall values stored in htcopy insert into temp // clear memory associated with htcopy // return temp return temp; }