Skip to content

Mirror ​

The left-right symmetry of a binary tree: every node's two subtrees swapped.

Mirror(BinaryTree)The left-right symmetry of a binary tree: every node's two subtrees swapped.
Typed signatures
TypePackageApplies
((binary_tree) -> binary_tree) & ((ordered_tree) -> ordered_tree)combinatoricsalways

Domain: Combinatorial maps

Details
  • Takes a BinaryTree and returns a BinaryTree — a typed map, so a wrong carrier is a type error rather than a wrong answer.
  • FindStat's Mp00016, an involution. Conjugated by the Dyck-path bijection it is DecompositionReverse.
  • Also takes a OrderedTree, returning a OrderedTree: The left-right symmetry of an ordered tree: every node's children in the opposite order.
  • FindStat's Mp00048, an involution.

Examples

Basic #

a four-node tree

live ↗
InMirror(BinaryTree⁡([[0,0],[0,[0,0]]]))\mathrm{Mirror}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack0, \bigl\lbrack0, 0\bigr\rbrack\bigr\rbrack\bigr\rbrack))OutBinaryTree⁡([[[0,0],0],[0,0]]){\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack, \bigl\lbrack0, 0\bigr\rbrack\bigr\rbrack)

an ordered tree with four edges

live ↗
InMirror(OrderedTree⁡([[[],[]],[]]))\mathrm{Mirror}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigl\lbrack\bigr\rbrack, \bigl\lbrack\bigr\rbrack\bigr\rbrack, \bigl\lbrack\bigr\rbrack\bigr\rbrack))OutOrderedTree⁡([[],[[],[]]]){\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigr\rbrack, \bigl\lbrack\bigl\lbrack\bigr\rbrack, \bigl\lbrack\bigr\rbrack\bigr\rbrack\bigr\rbrack)
About
Examples2
CrosswalkFindStat ×2