Lecture 26
Learning objectives
After this class, you should be able to:
- Given a hash function, a collision resolution strategy, the hash table size, and a sequence of insertions, draw the state of the hash table without chaining after the insertions are complete.
- Explain how collisions are resolved in open-addressed hashing, and define linear probing.
- Given a hash function, the hash table size, a collision resolution strategy, and a sequence of insertions and searches, give the number of collisions in each insert and search operation.
- Identify applications where hash tables can be useful.
Reading assignment
- Section 5.4.
- Lecture: Hash tables.
Exercises and review questions
- Exercises and review questions on current lecture's material
- Show the state of a hash table without chainning of size
23
withf(i) = i + 3
after the following sequence of operations are complete. Also give the number of hash table entries searched (number of collisions +1) for each of the following operations. 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")
.- Questions on next lecture's material
- If a hash table gets too full, then we need to expand it. By how much should the table be expanded? Should elements be copied to the same location as in the original hash table?
Last modified: 2 Nov 2011