OFFSET
0,3
REFERENCES
F. Bergeron, G. Labelle and P. Leroux, Combinatorial Species and Tree-Like Structures, Camb. 1998, p. 239, Eq 79, A_5.
D. E. Knuth, Art of Computer Programming, Vol. 3, Sect. 6.2.3 (7) and (8).
LINKS
Alois P. Heinz, Rows n = 0..10, flattened
Ralf Hinze, Functional Pearls: Purely functional 1-2 brother trees, Journal of Functional Programming, 19(6):633-644, 2009, DOI: 10.1017/S0956796809007333.
R. C. Richards, Shape distribution of height-balanced trees, Info. Proc. Lett., 17 (1983), 17-20.
Wikipedia, AVL tree
FORMULA
See program.
EXAMPLE
There are 2 AVL trees of height 2 with 3 (leaf-) nodes:
o o
/ \ / \
o N N o
/ \ / \
N N N N
Triangle begins:
1
. 1
. . 2 1
. . . . 4 6 4 1
. . . . . . . 16 32 44 60 70 56 28 8 1
. . . . . . . . . . . . 128 448 864 1552 2720 ...
MAPLE
T:= proc(n, k) local B, z; B:= proc(x, y, d) if d>=1 then x+B(x^2+2*x*y, x, d-1) else x fi end; if n=0 then if k=1 then 1 else 0 fi else coeff(B(z, 0, n), z, k) -coeff(B(z, 0, n-1), z, k) fi end: fib:= m-> (Matrix([[1, 1], [1, 0]])^m)[1, 2]: seq(seq(T(n, k), k=fib(n+2)..2^n), n=0..6);
MATHEMATICA
t[n_, k_] := Module[{ b, z }, b[x_, y_, d_] := If[d >= 1, x + b[x^2 + 2*x*y, x, d-1], x]; If[n == 0, If[k == 1, 1, 0], Coefficient[b[z, 0, n], z, k] - Coefficient [b[z, 0, n-1], z, k]]]; fib[m_] := MatrixPower[{{1, 1}, {1, 0}}, m][[1, 2]]; Table[Table[t[n, k], {k, fib[n+2], 2^n}], {n, 0, 6}] // Flatten (* Jean-François Alcover, Dec 05 2013, translated from Alois P. Heinz's Maple program *)
CROSSREFS
KEYWORD
AUTHOR
Alois P. Heinz, Sep 04 2008
STATUS
approved