Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #25 Apr 02 2021 02:46:16
%S 1,1,4,220,60092152,203720181459953921762400,
%T 7088043372247785801830314829178419617696182324188730917543544992
%N Number of permutations of [n], [n+1], ... that result in a binary search tree of height n.
%C Empty external nodes are counted in determining the height of a search tree.
%H Alois P. Heinz, <a href="/A227822/b227822.txt">Table of n, a(n) for n = 0..9</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Binary_search_tree">Binary search tree</a>
%H <a href="/index/Ro#rooted">Index entries for sequences related to rooted trees</a>
%H <a href="/index/Tra#trees">Index entries for sequences related to trees</a>
%F a(n) = Sum_{k=n..2^n-1} A195581(k,n).
%e a(2) = 4, because 4 permutations of {1,2}, {1,2,3}, ... result in a binary search tree of height 2:
%e (1,2): 1 (2,1): 2 (2,1,3), (2,3,1): 2
%e / \ / \ / \
%e o 2 1 o 1 3
%e / \ / \ / \ / \
%e o o o o o o o o
%p b:= proc(n, k) option remember; `if`(n<2, `if`(k<n, 0, 1),
%p add(binomial(n-1, r)*b(r, k-1)*b(n-1-r, k-1), r=0..n-1))
%p end:
%p a:= n-> add(b(k, n)-b(k, n-1), k=n..2^n-1):
%p seq(a(n), n=0..6);
%t b[n_, k_] := b[n, k] = If[n < 2, If[k < n, 0, 1],
%t Sum[Binomial[n - 1, r]*b[r, k - 1]*b[n - 1 - r, k - 1], {r, 0, n - 1}]];
%t a[n_] := Sum[b[k, n] - b[k, n - 1], {k, n, 2^n - 1}];
%t a /@ Range[0, 6] (* _Jean-François Alcover_, Apr 02 2021, after _Alois P. Heinz_ *)
%Y Column sums of A195581 and of A244108.
%Y Cf. A317012.
%K nonn
%O 0,3
%A _Alois P. Heinz_, Jul 31 2013
%E Terms corrected by _Alois P. Heinz_, Dec 08 2015