notes31

notes31 - WEEK 5 NOTES (Sparsh

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: WEEK 5 NOTES (Sparsh Shekhar)---------------------------HashTables--------------------------- **(HashTableVoid.h)** : struct HashTableVoidEntry { const char * _key; void * _data; HashTableVoidEntry * _next; }; class HashTableVoid { public: enum { TableSize = 2039}; HashTableVoidEntry **_buckets; int hash(const char * key); public: HashTableVoid(); // Add a record to the hash table. Returns true if key already exists. // Substitute content if key already exists. bool insertItem( const char * key, void * data); // Find a key in the dictionary and place in "data" the corresponding record // Returns false if key is does not exist bool find( const char * key, void ** data); // Removes an element in the hash table. Return false if key does not exist. bool removeElement(const char * key); }; class HashTableVoidIterator { int _currentBucket; HashTableVoidEntry *_currentEntry; HashTableVoid * _hashTable; public: HashTableVoidIterator(HashTableVoid * hashTable); bool next(const char * & key, void * & data); }; **(HashTableVoid.cc)** :...
View Full Document

Page1 / 6

notes31 - WEEK 5 NOTES (Sparsh

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

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