-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat: Lowest Common Ancestor (LCA) algorithm. #512
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.
Looks good, thanks!
I feel like the graph implementation that exists in the graph package could have been adapted instead of creating a new graph data structure. |
@tjgurwara99 Thank you for your response. You are right, the graph implementation in the graph package can be adapted. But |
Can you explain your reasoning for why the |
@tjgurwara99 Hi! As I understand, |
I don't know what you're talking about here... Lookup in hash maps is O(1) on good case and O(n) on worst case (if you want to go more in depth - read this article - so I don't think it has anything to do with load factor. In fact, maps with keys from finite domain ( PS: Load factor (to my knowledge) is only relevant in order to resize the buckets to maintain the lookup speed to O(1) and put speed to O(1) |
Hi guys! I want to add an implementation of LCA algorihm.