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

Leah - Space #17

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

Leah - Space #17

wants to merge 2 commits into from

Conversation

leahwho
Copy link

@leahwho leahwho commented Sep 14, 2020

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? If you use a bad hash function, you'll get overlapping keys or all your data will be in a cluster.
How can you judge if a hash function is good or not? If it consistently gives you unique keys and your data is spread out across the structure
Is there a perfect hash function? If so what is it? I don't think so.
Describe a strategy to handle collisions in a hash table If you get a collision, you can do linear or quadratic probing, which means you move whatever you're storing to a new space in your structure.
Describe a situation where a hash table wouldn't be as useful as a binary search tree If you can't be mostly certain you'll get unique keys, a BST is probably a better option.
What is one thing that is more clear to you on hash tables now I understand how hashes work under the hood in Ruby! This is SO COOL.

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, see my few notes Leah, but otherwise you did well here.

Comment on lines +4 to 6
# Time Complexity: O(n) - n is number of words in the array
# Space Complexity: O(n) - n is number of words in the array
def grouped_anagrams(strings)

Choose a reason for hiding this comment

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

👍

Comment on lines +26 to 28
# Time Complexity: O(n) - n is length of list
# Space Complexity: O(n) - n is the length of the list
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.

👍 , nice work, however you're already sorting the list, which would be O(n log n)

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