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

Sarah #12

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

Sarah #12

wants to merge 2 commits into from

Conversation

sjscotton
Copy link

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? Its the reason we can achieve 0(1) lookup on Hash tables
How can you judge if a hash function is good or not? Its spreads items out evenly, It should be quick, and the same key should always produce the same result.
Is there a perfect hash function? If so what is it? no
Describe a strategy to handle collisions in a hash table One strategy is chaining, where when you have a collision you add the item to the back of a linked list connected to that bucket.
Describe a situation where a hash table wouldn't be as useful as a binary search tree Anytime you want the items sorted, Hash tables dont have any ordering at all
What is one thing that is more clear to you on hash tables now How hash tables operate behind the scenes.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

You have the exact answer here, well done!

@@ -2,11 +2,21 @@

# 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(n * m log m) where n is the length of the list, and m is length of the string, because you itereate over the list once, and for each word you sort it, which lis m log m

Choose a reason for hiding this comment

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

Exactly

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