NW | 26-SDC-Mar | Zabihollah Namazi | Sprint 2 | improve with precomputing #178
NW | 26-SDC-Mar | Zabihollah Namazi | Sprint 2 | improve with precomputing #178ZabihollahNamazi wants to merge 2 commits into
Conversation
cjyuan
left a comment
There was a problem hiding this comment.
Code looks good.
Could you use complexity to explain how the new implementation is better than the original implementation?
|
-Common Prefix: New Way (Fast): By sorting the list first (O(N log N . M)) , words that look alike are automatically grouped right next to each other. Now, the code only needs to look at neighbor pairs in one quick pass. It cuts out thousands of useless comparisons! -Count Letters |
|
Explanation is clear. Well done. Note: You could also just mention the complexity of the original Common Prefix algorithm is O(M*N^2) without giving an example of 10,000 words. |
|
Closing PR because the SDC run has finished. Feel free to re-open if you're still working on it. |
Hi! Could you please check my code?
The old code used slow loops and would freeze with big data. I fixed them by using sorting and sets so they now run instantly and easily handle millions of characters.All tests are passing perfectly. Thank you!