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

Earth - Emily #2

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

Earth - Emily #2

wants to merge 3 commits into from

Conversation

emirry
Copy link

@emirry emirry commented Apr 20, 2021

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? A good hash function is important to be able to convert any key to a number. If it's done right, it can scale well and mostly map out keys to different values quickly.
How can you judge if a hash function is good or not? You can judge if a hash function is good if it can execute in constant time, if it's consistent, and if it can cause fewer collisions.
Is there a perfect hash function? If so what is it? No? Hashing functions are known as heuristics.
Describe a strategy to handle collisions in a hash table One strategy is linear probing. Linear probing is a way to handle collisions by searching through the array to place the element in the next available bucket.
Describe a situation where a hash table wouldn't be as useful as a binary search tree Finding the min and max of something..
What is one thing that is more clear to you on hash tables now I feel like I understand hash functions a little better. I didn't really understand how keys were placed in the array when we first learned about hash tables.

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 Emily, you hit the learning goals here. Well done.

Comment on lines +3 to 5
// Time Complexity: O(n+m)?
// Space Complexity: O(n)
function grouped_anagrams(strings) {

Choose a reason for hiding this comment

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

Since you are sorting the solution is O(n * m log m) where n is the length of the list and m is the biggest number of characters in the individual strings.

Comment on lines +29 to 31
// Time Complexity: O(nlog(n))?
// Space Complexity: O(n)
function 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.

👍 Well done!

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