You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mssmt: add tree copy functionality for full and compacted trees
This commit introduces a new `Copy` method to both the `FullTree` and
`CompactedTree` implementations of the MS-SMT. This method allows copying
all key-value pairs from a source tree to a target tree, assuming the
target tree is initially empty.
The `Copy` method is implemented differently for each tree type:
- For `FullTree`, the method recursively traverses the tree, collecting all
non-empty leaf nodes along with their keys. It then inserts these leaves
into the target tree.
- For `CompactedTree`, the method similarly traverses the tree, collecting
all non-empty compacted leaf nodes along with their keys. It then inserts
these leaves into the target tree.
A new test case, `TestTreeCopy`, is added to verify the correctness of
the `Copy` method for both tree types, including copying between
different tree types (FullTree to CompactedTree and vice versa). The
test case generates a set of random leaves, inserts them into a source
tree, copies the source tree to a target tree, and then verifies that
the target tree contains the same leaves as the source tree.
0 commit comments