@@ -59,6 +59,10 @@ Pointers in new vertices are updated to point to new copies of corresponding ver
...
@@ -59,6 +59,10 @@ Pointers in new vertices are updated to point to new copies of corresponding ver
The root of the newly created version is the copy of the original root. Thus the new version now shares some vertices with the old version.
The root of the newly created version is the copy of the original root. Thus the new version now shares some vertices with the old version.
Here we tacitly assume that only pointers to children are stored. Updating the root in a tree with pointers to parents would involve creating copies for all nodes in the tree.
Here we tacitly assume that only pointers to children are stored. Updating the root in a tree with pointers to parents would involve creating copies for all nodes in the tree.
Insertion of a vertex G is depicted in figure \figref{path-copying}.
We can see an original tree with vertices A, B, C, D, E, F.
The thick vertices are created by the insert operation.
This method yields a functional data structure since the old version of the tree was technically not modified and can still be used.
This method yields a functional data structure since the old version of the tree was technically not modified and can still be used.
With reasonable variants of binary search trees, achieved time complexity in a tree with $n$ vertices is $\Theta(\log n)$ per operation and $\Theta(\log n)$ memory for insert/delete.
With reasonable variants of binary search trees, achieved time complexity in a tree with $n$ vertices is $\Theta(\log n)$ per operation and $\Theta(\log n)$ memory for insert/delete.
...
@@ -66,7 +70,6 @@ The downside of this method is the increased space complexity.
...
@@ -66,7 +70,6 @@ The downside of this method is the increased space complexity.
There is no apparent construction that would not increase memory complexity by copying the paths.
There is no apparent construction that would not increase memory complexity by copying the paths.