4.2.6-7 - FoDS (Hash Tables and Dictionaries) Flashcards
1
Q
What is a hash table
A
A Data structure that creates a mapping between keys and values as pairs
2
Q
What is an abstract data type
A
3
Q
What are hash tables made of
A
- An array we call a hash table
- This is linked to a hash function
- Keys are inputted into the function which returns a hash value
- The hash value determines where in the hash table the value is stored
4
Q
What are some examples of hash functions
A
- Summations
- Modulus functions
5
Q
What is meant by a collision
A
- When two key values compute to the same hash
6
Q
What are the 3 ways to avoid collisions
A
- Closed Hashing
- Open Hashing
- Rehashing
7
Q
How does a Closed-Hashing work
A
When there is a collision:
- data is stored in the next available empty location in the hash table
- The original location points to the next location
8
Q
A