Crates.io | catalan |
lib.rs | catalan |
version | 0.3.3 |
source | src |
created_at | 2020-09-24 03:57:38.397896 |
updated_at | 2023-03-01 10:10:48.352977 |
description | binary tree of n variables where the parent node represents a function and the child node represents a value. |
homepage | |
repository | https://github.com/oovm/catalan-tree |
max_upload_size | |
id | 292340 |
size | 36,168 |
Binary tree of n variables where the parent node represents a function and the child node represents a value.
f(n, n)
f(n, f(n, n))
f(f(n, n), n)
f(n, f(n, f(n, n)))
f(n, f(f(n, n), n))
f(f(n, n), f(n, n))
f(f(n, f(n, n)), n)
f(f(f(n, n), n), n)
f(n, f(n, f(n, f(n, n))))
f(n, f(n, f(f(n, n), n)))
f(n, f(f(n, n), f(n, n)))
f(n, f(f(n, f(n, n)), n))
f(n, f(f(f(n, n), n), n))
f(f(n, n), f(n, f(n, n)))
f(f(n, n), f(f(n, n), n))
f(f(n, f(n, n)), f(n, n))
f(f(f(n, n), n), f(n, n))
f(f(n, f(n, f(n, n))), n)
f(f(n, f(f(n, n), n)), n)
f(f(f(n, n), f(n, n)), n)
f(f(f(n, f(n, n)), n), n)
f(f(f(f(n, n), n), n), n)
f(n, f(n, f(n, f(n, f(n, n)))))
f(n, f(n, f(n, f(f(n, n), n))))
f(n, f(n, f(f(n, n), f(n, n))))
f(n, f(n, f(f(n, f(n, n)), n)))
f(n, f(n, f(f(f(n, n), n), n)))
f(n, f(f(n, n), f(n, f(n, n))))
f(n, f(f(n, n), f(f(n, n), n)))
f(n, f(f(n, f(n, n)), f(n, n)))
f(n, f(f(f(n, n), n), f(n, n)))
f(n, f(f(n, f(n, f(n, n))), n))
f(n, f(f(n, f(f(n, n), n)), n))
f(n, f(f(f(n, n), f(n, n)), n))
f(n, f(f(f(n, f(n, n)), n), n))
f(n, f(f(f(f(n, n), n), n), n))
f(f(n, n), f(n, f(n, f(n, n))))
f(f(n, n), f(n, f(f(n, n), n)))
f(f(n, n), f(f(n, n), f(n, n)))
f(f(n, n), f(f(n, f(n, n)), n))
f(f(n, n), f(f(f(n, n), n), n))
f(f(n, f(n, n)), f(n, f(n, n)))
f(f(n, f(n, n)), f(f(n, n), n))
f(f(f(n, n), n), f(n, f(n, n)))
f(f(f(n, n), n), f(f(n, n), n))
f(f(n, f(n, f(n, n))), f(n, n))
f(f(n, f(f(n, n), n)), f(n, n))
f(f(f(n, n), f(n, n)), f(n, n))
f(f(f(n, f(n, n)), n), f(n, n))
f(f(f(f(n, n), n), n), f(n, n))
f(f(n, f(n, f(n, f(n, n)))), n)
f(f(n, f(n, f(f(n, n), n))), n)
f(f(n, f(f(n, n), f(n, n))), n)
f(f(n, f(f(n, f(n, n)), n)), n)
f(f(n, f(f(f(n, n), n), n)), n)
f(f(f(n, n), f(n, f(n, n))), n)
f(f(f(n, n), f(f(n, n), n)), n)
f(f(f(n, f(n, n)), f(n, n)), n)
f(f(f(f(n, n), n), f(n, n)), n)
f(f(f(n, f(n, f(n, n))), n), n)
f(f(f(n, f(f(n, n), n)), n), n)
f(f(f(f(n, n), f(n, n)), n), n)
f(f(f(f(n, f(n, n)), n), n), n)
f(f(f(f(f(n, n), n), n), n), n)
treeR[1] = n;
treeR[n_] := treeR[n] = Table[f[treeR[a], treeR[n - a]], {a, 1, n - 1}]
treeC[n_] := Flatten[treeR[n] //. {f[a_List, b_] :> (f[#, b]& /@ a), f[a_, b_List] :> (f[a, #]& /@ b)}]
StringRiffle[
StringReplace[ToString[#], {"[" -> "(", "]" -> ")"}]& /@ treeC[6],
"\n"
]
% // CopyToClipboard