Hashing Flashcards
1
Q
How does chaining work in terms of hashing?
A
- Chaining is a Collision Resolution Policy (CRP)
- if a location is full, add items to a linked list.
- Performance degrades if load factor is high and the linked lists become long.
- Lookup time is, on average, 1 + λ (1 to find bucket, average of λ to go through linked list).
- Like a BST, performance can degrade to O(n), plus linked lists add list pointer data and will
not balance distribution among buckets. - Performance can be poor but implementation is simple and hash table can’t become full.
2
Q
List some Collision Resolution Policies
A
Chaining
Linear Probing / Open addressing
Quadratic Probing
Double hashing
3
Q
Disadvantage of linear probing?
A
■ One big disadvantage is that this leads to the formation of clusters with no empty
spaces.
■ Performance can degrade to a linear scan.
■ Hash table can become FULL.