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

Branches - Brianna #5

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

Branches - Brianna #5

wants to merge 3 commits into from

Conversation

brikemp
Copy link

@brikemp brikemp commented Mar 10, 2020

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? It keeps lookup time low by preventing too many collisions
How can you judge if a hash function is good or not? If a hash has too many collisions or too much data in adjacent buckets it slows down look up time, which makes the function perform worse.
Is there a perfect hash function? If so what is it? No, the best hash function for a situation depends on the data
Describe a strategy to handle collisions in a hash table Chaining is a strategy that handles collisions through array management
Describe a situation where a hash table wouldn't be as useful as a binary search tree Any situation where order matters, ex finding the median
What is one thing that is more clear to you on hash tables now The underlying functions and what goes into managing data stored in hashes

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.

Great work Brianna, you hit all the learning goals and got the optional as well. Excellent work.

Comment on lines +3 to 5
// Time Complexity: O(n * m log m) - N: number of strings passed in; M: sorting time of each string
// Space Complexity: O(n * m) - N: number of unique letter sets; M: number of total arrays stored
function grouped_anagrams(strings) {

Choose a reason for hiding this comment

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

👍 Nice work!

Comment on lines +22 to 24
// Time Complexity: O(n + m) -> O(n) - N: length of list; m: unique numbers
// Space Complexity: O(m) m: unique numbers entered in hash
function 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.

👍 Nice work!

Comment on lines +116 to +134


// console.log(grouped_anagrams(["eat", "tea", "tan", "ate", "nat", "bat"]));
// console.log(grouped_anagrams([]));
// console.log(grouped_anagrams(["eat", "ear", "tar", "pop", "pan", "pap"]));
// console.log(grouped_anagrams(["eat", "tae", "tea", "eta", "aet", "ate"]));
// console.log(grouped_anagrams(["tea","","eat","","tea",""]));
// console.log(top_k_frequent_elements([1,1,1,2,2,3], 2))
// console.log(top_k_frequent_elements([], 1))
console.log(valid_sudoku([
[".","8","7","6","5","4","3","2","1"],
["2",".",".",".",".",".",".",".","."],
["3",".",".",".",".",".",".",".","."],
["4",".",".",".",".",".",".",".","."],
["5",".",".",".",".",".",".",".","."],
["6",".",".",".",".",".",".",".","."],
["7",".",".",".",".",".",".",".","."],
["8",".",".",".",".",".",".",".","."],
["9",".",".",".",".",".",".",".","."]]))

Choose a reason for hiding this comment

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

You can leave this out of a submission.

Comment on lines -23 to 69
// Time Complexity: ?
// Time Complexity: O(n*m) - n: rows in sudoku table; m: columns in sudoku table
// Space Complexity: ?

function valid_sudoku(table) {

Choose a reason for hiding this comment

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

Really elegant solution! 👍

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