Mary Tian CS Fun Hash Practice #73
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions
How can you judge if a hash function is good or not? |
Is it efficient
Is each table position equally likely for each key
Is there a perfect hash function? If so what is it? |
A perfect hash function maps each of the keys to a unique integer, with no collisions.
Describe a strategy to handle collisions in a hash table |
Separate chaining - each element in hash table is a linked list. To store an element in the hash table you must insert it into a specific linked list.
Describe a situation where a hash table wouldn't be as useful as a binary search tree |
Hash table has to have unique keys. If a dataset cannot provide unique key values, a binary search tree is better.
What is one thing that is more clear to you on hash tables now |
Hash tables can be much faster than other data structures.