Well, weird; first I asked myself if we roll it all back and try to write it immutably, that is, start building the tree starting from leaves... then I figure, it was my solution (big deal, use call stack instead)
What I find weird is that the immutable solution forces you to look at it inductively. You start expressing yourself in terms of subtrees (how do we know we have the whole left subtree for a node; how do we know we have the whole right subtree), because you can no longer think about "setting" pointers, or tweaking them later.
This imperative piece was obtained to see if we can do the same in reverse.
Comments 8
Кусаю крупные куски, жЫр во все стороны, вкуснотищщаа!
Ой, обляпался...
;-)
Reply
Reply
This imperative piece was obtained to see if we can do the same in reverse.
Reply
Reply
Reply
Leave a comment