Lecture 27
Learning objectives
After this class, you should be able to:
- Derive the worst case and expected case time complexities for insertion into a hash table.
- Given a hash function, initial hash table size, a collision resolution strategy, and a sequence of insertions and searches, show the state of the hash table after the sequence of operations, rehashing when necessary.
Reading assignment
- Section 5.5.
- Lecture: Hash tables.
Exercises and review questions
- Exercises and review questions on current lecture's material
- Show the state of a hash table without chaining having initial size
11
withf(i) = i + 3
after the following sequence of operations are complete. Use the hash function in slide 11 of Lecture 24 for the hashing.insert("abcd"), insert("dbcd"), search("decd"), insert("abdc"), insert("bbcd"), insert("dabc"), search("decd"), insert("decd")
. Assume that the table size is increased when the occupancy exceeds 50%. When the size is increased, it is made the smallest prime number greater than double the current size.- We discussed the need for rehashing when the hash table size is increased. Could rehashing be useful when the hash table size has not increased?
- Questions on next lecture's material
- None.
Last modified: 4 Nov 2011