Closed neverfox closed 4 years ago
Another possibility would be to give the user an option: if the shallow paste operation finds that a bpointer already exists, either error or auto-switch to deep copy (you might get away with only deep copying the root of the pasted tree). The user could indicate which option they prefer in an argument.
This has been fixed with https://github.com/caesar0301/treelib/pull/129/
The issue was that nodes pointers were mixed up between trees.
During
rsearch
it appears to follow a back-pointer into the other copy. This makes sense, I suppose, given that the bpointer is set during pasting (and the last paste dominates). I'm not sure what the solution might be without storing multiple bpointers and then filtering them against nodes in the tree.