Open
Conversation
kyra-patton
reviewed
Jul 28, 2022
kyra-patton
left a comment
There was a problem hiding this comment.
✨ Nice work, Mary. The comprehension questions are not filled out so I am marking this as a yellow. Let me know what questions you have.
🟡
| Each subarray will have strings which are anagrams of each other | ||
| Time Complexity: ? | ||
| Space Complexity: ? | ||
| Time Complexity: O(nlogn)? Not sure on this |
There was a problem hiding this comment.
⏱ Time complexity will be O(n) or O(n*m), where n is the length of strings and m is the length of the longest element in strings since sorted is an O(m) operation. However, if we assume that all words in strings are valid English words, we can reduce the time complexity down to O(n) as m will be relatively small
| Time Complexity: ? | ||
| Space Complexity: ? | ||
| Time Complexity: 0(n) | ||
| Space Complexity: 0(n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions
How can you judge if a hash function is good or not? |
Is it efficient
Is each table position equally likely for each key
Is there a perfect hash function? If so what is it? |
A perfect hash function maps each of the keys to a unique integer, with no collisions.
Describe a strategy to handle collisions in a hash table |
Separate chaining - each element in hash table is a linked list. To store an element in the hash table you must insert it into a specific linked list.
Describe a situation where a hash table wouldn't be as useful as a binary search tree |
Hash table has to have unique keys. If a dataset cannot provide unique key values, a binary search tree is better.
What is one thing that is more clear to you on hash tables now |
Hash tables can be much faster than other data structures.