Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Khandice Schuhmann #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Khandice Schuhmann #2

wants to merge 4 commits into from

Conversation

khandices
Copy link

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? It helps to prevent collisions
How can you judge if a hash function is good or not? By how often a collision happens and how it handles a potential collision
Is there a perfect hash function? If so what is it? No, there are no perfect hash functions.
Describe a strategy to handle collisions in a hash table If a collision occurs, a hash function can use linear probing to find the next available slot by checking each next slot.
Describe a situation where a hash table wouldn't be as useful as a binary search tree When items need to be kept in a specific order.
What is one thing that is more clear to you on hash tables now The abstraction of it, there are many working parts behind something that is so useful. That there is an algorithm of placement of the keys.

@chimerror
Copy link

Grabbing this to grade!

Copy link

@chimerror chimerror left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work!

Added a little comment about an incorrect time complexity calculation, but that's not enough to move down from Green.

@@ -1,33 +1,57 @@
// This method will return an array of arrays.
// Each subarray will have strings which are anagrams of each other
// Time Complexity: ?
// Space Complexity: ?
// Time Complexity: O(1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is O(n) time complexity, where n is the number of words. Yes, querying and updating anagramDict is O(1), but we have to do it n times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants