Hashing Flashcards

1
Q

worst case performance of hash search

A

Worst case:
T(n) = time hash + time linear search
T(n) = 0(1) + O(n)
T(n) = O(n)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

base case performance of hash search

A

Best case:
T(n) = time hash + time retrieve element
T(n) = 0(1) + O(1)
T(n) = O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Open addressing techniques

A

Linear Probing: If position h(key) is occupied, do a linear search in the table until you find a empty slot.
Quadratic probing: is a variant of the above where the term being added to the hash result is squared. h(key)+c2
Random probing: is another variant where the term being added to the hash function is a random number. h(key)+random()
Rehashing: is a technique where a sequence of hashing functions are defined
(h1, h2, … hk). If a collision occurs the functions are used in the this order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Separate chaining techniques

A

The most common resolution mechanism is called separate chaining or just chaining,
It consists of mixing the concepts of linked lists and direct access structures like arrays
Each slot of a hash table is a pointer to a dynamic structure (say a linked list or a binary search tree)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly