tweak zipper
authorJim Pryor <profjim@jimpryor.net>
Fri, 26 Nov 2010 16:30:10 +0000 (11:30 -0500)
committerJim Pryor <profjim@jimpryor.net>
Fri, 26 Nov 2010 16:30:10 +0000 (11:30 -0500)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
zipper.mdwn

index 5bdf345..8775231 100644 (file)
@@ -240,4 +240,7 @@ Supposing you did work out an implementation of the tree zipper, then one way to
 
 you won't move upwards at the same steps. Keep comparing "the next leafs" until they are different, or you exhaust the leafs of only one of the trees (then again the trees have different fringes), or you exhaust the leafs of both trees at the same time, without having found leafs with different labels. In this last case, the trees have the same fringe.
 
 
 you won't move upwards at the same steps. Keep comparing "the next leafs" until they are different, or you exhaust the leafs of only one of the trees (then again the trees have different fringes), or you exhaust the leafs of both trees at the same time, without having found leafs with different labels. In this last case, the trees have the same fringe.
 
+If your trees are very big---say, millions of leaves---you can imagine how this would be quicker and more memory-efficient than traversing each tree to construct a list of its fringe, and then comparing the two lists so built to see if they're equal. For one thing, the zipper method can abort early if the fringes diverge early, without needing to traverse or built a list containing the rest of each tree's fringe.
+
+