Effects of changing a node in a binary tree

Posted by eSKay on Stack Overflow See other posts from Stack Overflow or by eSKay
Published on 2010-04-09T18:29:41Z Indexed on 2010/04/09 18:43 UTC
Read the original article Hit count: 465

Suppose I want to change the orange node in the following tree.

So, the only other change I'll need to make is in the left pointer of the green node.

The blue node will remain the same.

alt text

Am I wrong somewhere? Because according to this article (that explains zippers), even the blue node needs to be changed.

Similarly, in this picture (recolored) from the same article, why do we change the orange nodes at all (when we change x)?

alt text

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about data-structures