Skip to content

Khandice Schuhmann#2

Open
khandices wants to merge 4 commits intoAda-C16:masterfrom
khandices:master
Open

Khandice Schuhmann#2
khandices wants to merge 4 commits intoAda-C16:masterfrom
khandices:master

Conversation

@khandices
Copy link

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? It helps to prevent collisions
How can you judge if a hash function is good or not? By how often a collision happens and how it handles a potential collision
Is there a perfect hash function? If so what is it? No, there are no perfect hash functions.
Describe a strategy to handle collisions in a hash table If a collision occurs, a hash function can use linear probing to find the next available slot by checking each next slot.
Describe a situation where a hash table wouldn't be as useful as a binary search tree When items need to be kept in a specific order.
What is one thing that is more clear to you on hash tables now The abstraction of it, there are many working parts behind something that is so useful. That there is an algorithm of placement of the keys.

@chimerror
Copy link

Grabbing this to grade!

Copy link

@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!

Added a little comment about an incorrect time complexity calculation, but that's not enough to move down from Green.

// Each subarray will have strings which are anagrams of each other
// Time Complexity: ?
// Space Complexity: ?
// Time Complexity: O(1)

Choose a reason for hiding this comment

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

This is O(n) time complexity, where n is the number of words. Yes, querying and updating anagramDict is O(1), but we have to do it n times.

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