We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
First of all, thank you for your work.
https://github.com/pulkit1joshi/handbook_codes/blob/main/Chapter%2018%3A%20Tree%20Queries/treequeries_lca_method1.1.cpp
The code for LCA Method 1 appears to have a time complexity of $O(N)$ rather than $O(logN)$ — for example, if the tree is skewed.
(The book says that method 1 has a time complexity of $O(logN)$.)
Using dynamic programming, it seems like it should be possible to move up two or more steps when reaching the minimum common ancestor vertex.
Thanks.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
First of all, thank you for your work.
https://github.com/pulkit1joshi/handbook_codes/blob/main/Chapter%2018%3A%20Tree%20Queries/treequeries_lca_method1.1.cpp
The code for LCA Method 1 appears to have a time complexity of$O(N)$ rather than $O(logN)$ — for example, if the tree is skewed.
(The book says that method 1 has a time complexity of$O(logN)$ .)
Using dynamic programming, it seems like it should be possible to move up two or more steps when reaching the minimum common ancestor vertex.
Thanks.
The text was updated successfully, but these errors were encountered: