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

Fire - Gessica Mohr #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fire - Gessica Mohr #18

wants to merge 1 commit into from

Conversation

GeMath18
Copy link

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? Because Hash Functions are good for lookups and gives a better time complexity.
How can you judge if a hash function is good or not? A good hash function must be consistent, should (mostly) map different keys to different values, should execute in constant time, and the hashing should appear to be random.
Is there a perfect hash function? If so what is it? No, there is not a perfect hash function.
Describe a strategy to handle collisions in a hash table Quadratic probing is that when inserting an element, if the bucket is full, instead of incrementally searching the array for an empty bucket, a formula is applied to search.
Describe a situation where a hash table wouldn't be as useful as a binary search tree Hash table would not be useful if the data needs to be sorted.
What is one thing that is more clear to you on hash tables now Learned on ways how to handle collisions.

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

Comment on lines +4 to 7
# Time Complexity: O(n)
# Space Complexity: O(n)

def grouped_anagrams(strings)

Choose a reason for hiding this comment

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

👍 However since you're sorting the words, the time complexity is O(n + m log m) where m is the length of the words. If you assume the words are limited in size, then it would be O(n).

Comment on lines +30 to 32
# Time Complexity: O(nlogn)
# 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.

👍

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