Lecture 26
Learning objectives
After this class, you should be able to:
- Given a hash function, the hash table size, and a sequence of insertions and deletions, draw the state of open-addressed (if a collision resolution strategy too is given) or chained hash tables after the operations are complete.
- Derive the worst case and expected case time complexities for hash table insertion, search, and deletion.
Reading assignment
- Section 10.2.2 (excluding coalesced hashing), 10.2.3 (excluding the strategy demonstrated in fig. 10.10d), class notes.
Exercises and review questions
- Exercises and review questions on current lecture's material
- Show the state of a chained hash table of size
23
after the following sequence of operations are complete. Also give the number of hash table entries searched for each of the following operations. Use the functionf1
defined in class, for the hashing.insert("abcd"), insert("dbcd"), search("decd"), insert("abdc"), insert("bbcd"), insert("dabc"), insert("decd"), delete("abdc"), search("dabc"), search("abdc")
.- Let an open addressed hash table be resized by doubling whenever
n/T
exceeds0.5
. Show that the amortized time complexity forn
insertions isO(n)
.- Questions on next lecture's material
- None.
Last modified: 10 Apr 2008