Skip to content

refactor util/TreeNode #276

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

Merged
merged 1 commit into from
Jan 9, 2021
Merged

refactor util/TreeNode #276

merged 1 commit into from
Jan 9, 2021

Conversation

cfriedt
Copy link
Owner

@cfriedt cfriedt commented Jan 9, 2021

This change uses the results of serialize-and-deserialize-binary-tree-test.cpp
to serialize and deserialize trees in O(N) time and O(N) space rather than
O(N^2) time and O(N^2) space.

Fixes #275

@cfriedt cfriedt force-pushed the issue/275/refactor-util-treenode branch 6 times, most recently from 9cf4cec to 798e287 Compare January 9, 2021 14:35
This change uses the results of serialize-and-deserialize-binary-tree-test.cpp
to serialize and deserialize trees in O(N) time and O(N) space rather than
O(N^2) time and O(N^2) space.

TreeNode_cleanup() is a no-op at the moment because it causes a number of
double free errors. I think I solved this previously be caching all of
the allocated TreeNode instances in a set and only calling delete when the
instance was still in the set.

Fixes #275

Signed-off-by: Christopher Friedt <chrisfriedt@gmail.com>
@cfriedt cfriedt force-pushed the issue/275/refactor-util-treenode branch from 798e287 to 53dc049 Compare January 9, 2021 14:37
@codecov-io
Copy link

Codecov Report

Merging #276 (53dc049) into master (830c5a5) will increase coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #276      +/-   ##
==========================================
+ Coverage   97.42%   97.47%   +0.05%     
==========================================
  Files         110      111       +1     
  Lines        2796     2857      +61     
==========================================
+ Hits         2724     2785      +61     
  Misses         72       72              
Impacted Files Coverage Δ
serialize-and-deserialize-binary-tree.cpp 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 830c5a5...53dc049. Read the comment docs.

@cfriedt cfriedt merged commit b1dcea4 into master Jan 9, 2021
@cfriedt cfriedt deleted the issue/275/refactor-util-treenode branch January 9, 2021 14:48
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.

refactor util/TreeNode
2 participants