-
Notifications
You must be signed in to change notification settings - Fork 9
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
Ringo - Earth #3
base: master
Are you sure you want to change the base?
Conversation
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.
Very well done Ringo, this hits all the learning goals and you also got Sudoku! Well done.
// Time Complexity: O(n*m log m) where n is the length of strings and | ||
// m is the length of the longest string in the strings array. | ||
// The for loop will run n times. Nested inside of that loop is a | ||
// sort function that will be O(m log m) for strings of length m. | ||
// Space Complexity: O(n). The sortedHash and the returned values array | ||
// will increase in size proportionate to the size of the input. | ||
function grouped_anagrams(strings) { |
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.
👍 , nice work on the space/time complexity
// Time Complexity: O(n log n). The controlling factor is the sort function | ||
// which is O(n log n). | ||
// Space Complexity: O(n). allHash and allKeys will both increase | ||
// linear to the size of list. returnArray will increase with the size of k. | ||
function top_k_frequent_elements(list, k) { |
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.
👍
// Time Complexity: O(1). The function does have a nested for loop. However, | ||
// the input is always going to be a nine-by-nine board. The function | ||
// will always have to look at, at most, 81 values one at a time. | ||
// The time complexity does not change with the input but is constant. | ||
// Space Complexity: O(1). The function makes 3 data structure that each, | ||
// worst case scenario, end up holding the same amount of values as in the | ||
// input. However, at most, this will be 81 values, 3 times -- a constant value. | ||
function valid_sudoku(table) { |
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.
👍 Great work identifying the space/time complexity
|
||
} | ||
|
||
function subgrid_helper(i, j) { |
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.
I love this helper
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions