Skip to content
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

Fix treetopologyex.11.cpp #26

Merged
merged 2 commits into from
Jun 14, 2024
Merged

Conversation

Sprdalo
Copy link
Collaborator

@Sprdalo Sprdalo commented Jun 14, 2024

Fixed the minor error and added a test case exploiting it.

@@ -102,5 +102,7 @@ struct tree_topology_ex : tree_topology {
int main() {
tree_topology_ex tt({{0, 1}, {1, 2}, {1, 3}}, 3);

cout << tt.kth(2, 3, 1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Printing a value doesn't really do anything towards the result of the test. You must compare it with the expected value and return 1 if they're different.

Another idea: Since the tree in this test case is quite small, let's add a different one with say, 10 nodes, pick some two vertices whose LCA is not 0, and test every vertex on the path between them by calling kth.

Copy link
Owner

@ivan100sic ivan100sic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ivan100sic ivan100sic merged commit b957cf8 into ivan100sic:main Jun 14, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants