Skip to content

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!

# 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