-
Notifications
You must be signed in to change notification settings - Fork 8
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
Kirsten #2
base: master
Are you sure you want to change the base?
Kirsten #2
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.
Nice work, this is pretty well done. Do take a look at my statements on the Big-O of these. Otherwise this is quite well done.
@@ -1,17 +1,24 @@ | |||
// This method will return an array of arrays. | |||
// Each subarray will have strings which are anagrams of each other | |||
// Time Complexity: ? | |||
// Space Complexity: ? | |||
// Time Complexity: O(n log n), where n is the combined length of the input strings (since the strings are being sorted) |
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.
But you're not sorting an array of all the characters in all the strings.
Instead I would say that the time complexity is O(n * m log m), where n is the number of strings and m
is the length of the largest string. If you could assume the all the strings were less than a certain number of characters you could then say it's O(n).
@@ -20,10 +27,56 @@ function top_k_frequent_elements(list, k) { | |||
// Each element can either be a ".", or a digit 1-9 | |||
// The same digit cannot appear twice or more in the same | |||
// row, column or 3x3 subgrid | |||
// Time Complexity: ? | |||
// Space Complexity: ? | |||
// Time Complexity: O(n), where n is the number of elements in the 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.
I would say instead O(n2) where n is the length of a side of the sudoku table.
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions