scratch

§ When Are the Catalan Numbers Odd

created 2021-12-26 · last edited 2023-04-02
  • The catalan numbers CnC_nCn​ count the number of binary trees on nnn nodes.
  • For every binary tree, label the nodes in some standard ordering (eg. BFS).
  • Pick the lex smallest unbalanced node (node with different left and right subtree sizes).
  • The operation that swaps the left and right subtrees of the lex smallest unbalanced node is an involution.
  • This operation only fails when we have a complete binary tree, so the number of nodes is n=2r−1n = 2^r - 1n=2r−1, so we pair such a complete binary tree to itself.
  • This breaks the set CnC_nCn​ into an even number of trees (pairs of unbalanced trees) and a potential "loner tree" (paired with itself) which is the complete binary tree.
  • Thus CnC_nCn​ is odd iff n=2r−1n = 2^r - 1n=2r−1, which allows for us to have a complete binary tree, which is not paired by the involution.
  • Reference
❦
Newer ৪ Blog ৪ Older