/* ============================================================================ Name : DogMap.c Author : David Mutchler and YOUR-NAME-HERE, November 2008. Description : The basics of a Map data structure that maps Dog names to pointers to Dog objects. ============================================================================ */ #include "DogMap.h" // Allocates an array (of the given size) of KeyDogPair* objects // and returns a pointer to it. // Also initializes each element of the array // to a pointer to a "Null Dog" (see the Dog class for "Null Dog"). KeyDogPair** constructHashTable(int hashTableSize) { // TODO (12 points) - replace this stub with correct code. return 0; } // Returns an integer that is the mapped value of the given key, // computed as follows: // -- the key is a string // -- the map is: // -- compute the sum of the ASCII values of the characters in the string // (just add up the characters, like they were integers) // -- return the sum mod hashTableSize. int hashMap(char* key, int hashTableSize) { // TODO (14 points) - replace this stub with correct code. return -1; } // Inserts the given Dog pointer into the given hashTable, // using the Dog's name as the key // and using hashMap as the mapping function. // Returns 0 if the insertion replaces a "Null Dog" // ("Null Dogs" are Dogs whose name is the empty string, ""), // else returns -1 (indicating a collision). int insert(Dog* dog, KeyDogPair** hashTable, int hashTableSize) { // TODO (12 points) - replace this stub with correct code. return -99; }