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

Leaves_Ga-Young #31

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

Leaves_Ga-Young #31

wants to merge 4 commits into from

Conversation

gyjin
Copy link

@gyjin gyjin commented Mar 10, 2020

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? To avoid collisions and allow fast lookup
How can you judge if a hash function is good or not? If the functions creates a wide enough spread of assigning values so there are no collisions
Is there a perfect hash function? If so what is it? There is no one perfect hash function
Describe a strategy to handle collisions in a hash table One way is to make each bucket the head of a linked list
Describe a situation where a hash table wouldn't be as useful as a binary search tree A situation where data needs to ordered, a binary search tree would be better than a hash table
What is one thing that is more clear to you on hash tables now How hash tables manage 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, you hit the main learning goals here. Well done. Take a look at my comments on time complexity. Let me know if you have questions.

Comment on lines +5 to 8
# Time Complexity: O(n log n) ?? because of the word sort section
# Space Complexity: O(n) where n is the length of the string 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.

If the words can be any length the time complexity is O(n * m log m) where m is the length of the words since you're sorting each word.

Comment on lines +36 to 38
# Time Complexity: O(n log n) ?? because of the hash sort_by section
# Space Complexity: O(n) where n is the length of 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.

👍

Comment on lines 70 to -29
# Time Complexity: ?
# Space Complexity: ?
def valid_sudoku(table)
raise NotImplementedError, "Method hasn't been implemented yet!"

Choose a reason for hiding this comment

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

Looks like you got started here, but didn't quite finish.

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