-
Notifications
You must be signed in to change notification settings - Fork 6
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
C16 - Afina Walton #1
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.
🤠 Nice work Afina. I left some comments on time and space complexity, but otherwise looks good. Answers to the comprehension questions are also solid.
🟢
@@ -1,19 +1,54 @@ | |||
// 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^2) |
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.
✨If you want to include sorting the strings in your time complexity, we could say that the time complexity is O(n m log(m)) where m is the length of the string you are sorting and n is the length of strings
Space complexity would also be O(n) where counter and grouped are each of size n
return counterArray | ||
} | ||
|
||
function topKFrequentElements(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.
✨ Nice! Since you are sorting the array, it would be O(n log n) time complexity
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions