Conversation
|
Grabbing this to grade! |
chimerror
left a comment
There was a problem hiding this comment.
Good work!
I added some comments about your missing complexity calculations, and a bug when limiting the results in the top-k problem. However, as I have generally not been marking things Yellow for missing complexity calculations, and the problem is underspecified, I'm marking this Green.
| @@ -5,15 +5,54 @@ def grouped_anagrams(strings): | |||
| Time Complexity: ? | |||
| Space Complexity: ? | |||
There was a problem hiding this comment.
For both this and the top-K problem, complexity calculations are missing.
| final_list.append(num) | ||
| else: | ||
| break | ||
| check_next += 1 |
There was a problem hiding this comment.
Unfortunately this method of limiting the result to k values has the possibility of returning more than k values, particularly if there are ties. For example, given [1, 1, 1, 2, 2, 2, 3, 3, 4] with k = 2, [1, 2, 3] will be the returned result. Essentially, when i is zero both 1 and 2 will be added to final_list, then 3 will be added on the next iteration when i is one.
However, as our problem statement underspecifies how to handle ties, I do not think it's fair to ding you for this, I just wanted to call it to your attention.
Hash Table Practice
Congratulations! You're submitting your assignment!
Comprehension Questions