OFFSET
0,3
COMMENTS
This bijection of binary trees swaps the left and right subtree of a binary tree, but ONLY if BOTH are nonempty. If either the left or right hand side tree is empty, fixes the tree.
.A...B.C...D.......C...D.A...B.
..\./...\./.........\./...\./..
...x.....x...--->....x.....x...
....\.../.............\.../....
......x.................x......
...............................
((a . b) . (c . d)) -> ((c . d) . (a . b))
or fix, if either the left or right hand side subtree is empty.
LINKS
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jan 06 2009
STATUS
approved