Skip to content

Conversation

@iris-lux
Copy link

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? Without one, a hash table loses its usefulness.
How can you judge if a hash function is good or not? Consistency, constant time, different keys to different values, randomness.
Is there a perfect hash function? If so what is it? No.
Describe a strategy to handle collisions in a hash table Quadratic probing - when a collision occurs, a formula is applied to determine where the value is stored.
Describe a situation where a hash table wouldn't be as useful as a binary search tree If the dataset cannot provide unique key values.
What is one thing that is more clear to you on hash tables now The different types of collision-handling strategies.

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.

Nice work Iris, you hit the learning goals. Perfect answers regarding the space/time complexity. Well done.

Comment on lines +4 to 7
# Time Complexity: O(n * mlogm) where n is the number of strings and m is the number of letters in a string
# Space Complexity: O(n) where n is the number of strings

def grouped_anagrams(strings)

Choose a reason for hiding this comment

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

👍 Wow, so condensed.

Comment on lines +15 to 17
# Time Complexity: O(nlogn) (for the sort)
# Space Complexity: O(n)
def top_k_frequent_elements(list, k)

Choose a reason for hiding this comment

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

👍 Absolutely correct!

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