Skip to content

Conversation

@nerdyistrendy
Copy link

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? Faster Look up
How can you judge if a hash function is good or not? the less collisions the better
Is there a perfect hash function? If so what is it? a hash with no collision
Describe a strategy to handle collisions in a hash table chaining - create a linked list in the bucket
Describe a situation where a hash table wouldn't be as useful as a binary search tree When we are not searching for one specific value. eg. values <=2
What is one thing that is more clear to you on hash tables now How we handle collisions

@nerdyistrendy
Copy link
Author

Just realized I never submitted it on learn, sorry!

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

Comment on lines +4 to 8
# n => number of strings, m => largest number of characters of a string
# Time Complexity: n * mlog(m) (sorting n strings: n * mlog(m); lookup, push, assign: O(1), iterating o(n))
# Space Complexity: n * m (worst case has to create a new array/key for each string, and takes m space to sort it)

def grouped_anagrams(strings)

Choose a reason for hiding this comment

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

👍 Nice

Comment on lines +31 to 33
# Time Complexity: Olog(n) for sorting
# 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.

👍

Comment on lines +55 to 57
# Time Complexity: O(1) fixed grid
# Space Complexity: O(1)
def valid_sudoku(table)

Choose a reason for hiding this comment

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

👍 This works, but you can also do this with helper methods.

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