-
Notifications
You must be signed in to change notification settings - Fork 77
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
Maple: Rhyannon Rodriguez #69
base: master
Are you sure you want to change the base?
Conversation
Grabbing this to grade! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work!
I left some notes on your time complexity calculations for the anagrams and sudoku problems, but overall this demonstrates sufficient mastery of the material and therefore is good enough for a Green!
Time Complexity: ? | ||
Space Complexity: ? | ||
Time Complexity: While there appears only a single for-loop, | ||
.join() adds O(N) & sorted() adds O(nlogn) during their ideal case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note though, that the n
you refer to is the number of letters in each word, not the number of words in the list (let's call that m
). Since the O(n * log(n)) sorted
call gets called m
times, it would be more accurate to say that it is O(m * n * log(n)).
However, we can make a simplifying assumption. Given that we know the input is a list of English words, and that words in English don't get too large (about 5 letters per word on average), the effect of n
is going to be dwarfed by the effect of m
, the number of words in the list. After all, there may be hundreds or thousands of words in the list, but there are not going to be words of that size most likely.
Space Complexity: ? | ||
""" | ||
pass | ||
Time Complexity: Quadratic O(N^2) - nested for loop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be true if we took in arbitrary nxn grids, but luckily since we only accept 3x3 grids, we can actually just say this is O(n)!
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions
How can you judge if a hash function is good or not? |
Is there a perfect hash function? If so what is it? |
A perfect hash function is one that maps the set of actual key values to the table without any collisions
Describe a strategy to handle collisions in a hash table |
Have each bucket contain a linked list of elements that are hashed to that bucket or dynamic resizing, which may include, but is not restricted to: resizing by copying all entries, incremental resizing & monotonic keys.
Describe a situation where a hash table wouldn't be as useful as a binary search tree |
Binary Search Trees are generally memory-efficient since they do not reserve more memory than they need to, so if you have any memory considerations at all, BST would be more useful.
What is one thing that is more clear to you on hash tables now |
Main advantage of hash tables is the constant O(1) speed of access