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

hashes exercies #4

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

hashes exercies #4

wants to merge 2 commits into from

Conversation

r-spiel
Copy link

@r-spiel r-spiel commented May 2, 2021

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? To actual give the user O(1) lookup time.
How can you judge if a hash function is good or not? If there are few collisions.
Is there a perfect hash function? If so what is it? No collisions.
Describe a strategy to handle collisions in a hash table Chaining - using a linkedList to handle collisions.
Describe a situation where a hash table wouldn't be as useful as a binary search tree If you are looking for > 1 value.
What is one thing that is more clear to you on hash tables now What is happening behind the scenes. :)

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.

Well done Richelle, nice JavaScript solutions. You hit the learning goals here. Well done.

Comment on lines +3 to 8
// Time Complexity: O(n + m log(m))
// Space Complexity: O(n)

// n length of string
// m length of longest word
function grouped_anagrams(strings) {

Choose a reason for hiding this comment

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

👍

Comment on lines 24 to 28
// This method will return the k most common elements
// in the case of a tie it will select the first occuring element.
// Time Complexity: ?
// Space Complexity: ?
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.

👍 Well done,

Space & time complexity?

}

function subMatrixHelper(table, rowStart, colStart) {

Choose a reason for hiding this comment

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

I like the helper function here!

Comment on lines +57 to 60
// Time Complexity: O(1) fixed size grid 9 x 9
// Space Complexity: O(1) also fixed, the sets would be max the same size as the grid since they are mapping each element

function valid_sudoku(table) {

Choose a reason for hiding this comment

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

👍 Nice work Richelle!

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