// hash.cpp // Class for Hash data structure // * works in the same way as a hash in Perl // * keys are strings of type char* // * data elements are of type Typ // * objects have to be declared with maximal size, e.g. Hash hash1(10000) (num_slots should not be a power of 2) // * works also if maximal size is exceeded, but gets slower by a factor ~num_keys/num_slots #include "list.h" #include "hash.h" //////////////////////////////////////////////////////////////////////////////// // Main program: test class Hash //////////////////////////////////////////////////////////////////////////////// // int main() // { // Hash ihash(5); // char* key=new char[128]; // int data; // ihash.Fail(1000); // ihash.Add("So many monsters",36); // ihash.Add("So many chickens",25); // // cerr<<"Address of ihash(\"So many monsters\") is "<"<"<"<