Skip to content

Pine- Alma#38

Open
abecerrilsalas wants to merge 2 commits intoAda-C16:masterfrom
abecerrilsalas:master
Open

Pine- Alma#38
abecerrilsalas wants to merge 2 commits intoAda-C16:masterfrom
abecerrilsalas:master

Conversation

@abecerrilsalas
Copy link
Copy Markdown

@abecerrilsalas abecerrilsalas commented Jun 30, 2022

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 for avoiding collisions
How can you judge if a hash function is good or not? You can judge if a hash function is bad if clustering occurs.
Is there a perfect hash function? If so what is it? There is no perfect hash function.
Describe a strategy to handle collisions in a hash table. Linear probing is a strategy used to handle collisions by searching for an empty bucket.
Describe a situation where a hash table wouldn't be as useful as a binary search tree. A binary search tree would be very useful when needing to know the max and min values.
What is one thing that is more clear to you on hash tables now. Hash tables aren't that bad.

@chimerror
Copy link
Copy Markdown

Grabbing this to grade!

Copy link
Copy Markdown

@chimerror chimerror left a comment

Choose a reason for hiding this comment

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

Good work!

I left a comment about your time complexity calculation for the Top K elements problem, but this generally is a good implementation that demonstrates that you have learned the material. Which makes this good enough for a Green.

In the case of a tie it will select the first occuring element.
Time Complexity: ?
Space Complexity: ?
Time Complexity: O(n)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Don't forget to account for the O(k * log(k)) sorting you perform in line 30, where k is the number of unique numbers in the list. As k trends to n if every number is unique, I would consider this 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