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

Faiza #17

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

Faiza #17

wants to merge 6 commits into from

Conversation

Faiza1987
Copy link

Hash Table Practice

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
Why is a good Hash Function Important? It will make your app/algorithm more efficient
How can you judge if a hash function is good or not? A good hash function will have minimal collisions and avoid the clustering of data by using a quadratic formula.
Is there a perfect hash function? If so what is it? It is called a Minimal Perfect Hashing and can build a hash table with no collisions. It is only possible to build it if we know all the keys in advance, so there will be one slot for each key.
Describe a strategy to handle collisions in a hash table Linear probing: if a collision occurs, the algorithm will probe each index below the one where the collision occurred until it finds an empty spot.
Describe a situation where a hash table wouldn't be as useful as a binary search tree A hash table would not be ideal in any situation where the data must be ordered.
What is one thing that is more clear to you on hash tables now Situations where a hash table would be a good tool to use.

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.

Thanks for getting this in. You hit the learning goals here Remember that building a hash does involve increasing space complexity.

# Space Complexity: ?

# Time Complexity: O(n) because it will need to check every item in the array
# Space Complexity: O(1)

Choose a reason for hiding this comment

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

Since you're building a hash, the space complexity is O(n)

# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: O(n) because it will have to loop throught the entire array
# Space Complexity: O(1)

Choose a reason for hiding this comment

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

What about the space complexity of the hash?

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