Hash Tables Flashcards

1
Q

Direct hashing

A

Overwrites data when a collision is found

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

Code for direct hashing

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

Separate chaining

A

Each cell of the hash table points to a linked list of records that have the same hash function value

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

Code for separate chaining

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

Linear probing

A

Linear probe for the next available index

Formula:

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

Linear probing code

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

Quadratic probing

A

When a collision occurs, we iterate with i^2 to look for the next available slot in the table

Formula:

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

Quadratic probing code

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

Double hashing

A

When a collision happens, we use another hash function to look for an empty index

Formula:

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

Code for double hashing

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