The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A316944 Total height of the binary search trees summed over all permutations of [n]. 5
 0, 1, 4, 16, 80, 456, 3072, 23536, 202304, 1937920, 20470400, 236172288, 2955465216, 39893618688, 577937479680, 8944476580864, 147277509541888, 2570740210700288, 47418288632692736, 921669646969167872, 18829500772271472640, 403390045252173381632 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,3 COMMENTS Each permutation of [n] generates a binary search tree of height h (floor(log_2(n))+1 <= h <= n) when its elements are inserted in that order into the initially empty tree. The average height of a binary search tree on n elements is A195582(n)/A195583(n). Empty external nodes are counted in determining the height of a search tree. LINKS Alois P. Heinz, Table of n, a(n) for n = 0..449 Wikipedia, Binary search tree Index entries for sequences related to rooted trees Index entries for sequences related to trees FORMULA a(n) = Sum_{k=0..n} k * A195581(n,k) = Sum_{k=0..n} k * A244108(n,k). a(n) = A000142(n) * A195582(n)/A195583(n). EXAMPLE a(3) = 16 = 3 + 3 + (2+2) + 3 + 3: . 3 3 2 1 1 / \ / \ / \ / \ / \ 2 o 1 o 1 3 o 3 o 2 / \ / \ ( ) ( ) / \ / \ 1 o o 2 o o o o 2 o o 3 / \ / \ / \ / \ o o o o (2,1,3) o o o o (3,2,1) (3,1,2) (2,3,1) (1,3,2) (1,2,3) . MAPLE b:= proc(n, k) option remember; `if`(n<2, `if`(k add(k*(b(n, k)-b(n, k-1)), k=0..n): seq(a(n), n=0..25); MATHEMATICA b[n_, k_] := b[n, k] = If[n < 2, If[k < n, 0, 1], Sum[Binomial[n - 1, r]* b[r, k - 1] b[n - 1 - r, k - 1], {r, 0, n - 1}]]; a[n_] := Sum[k(b[n, k] - b[n, k - 1]), {k, 0, n}]; a /@ Range[0, 25] (* Jean-François Alcover, Jan 27 2021, after Alois P. Heinz *) CROSSREFS Cf. A000142, A000523, A195581, A195582, A195583, A244108, A335921. Sequence in context: A160564 A075581 A171454 * A020080 A279361 A003471 Adjacent sequences: A316941 A316942 A316943 * A316945 A316946 A316947 KEYWORD nonn AUTHOR Alois P. Heinz, Jul 17 2018 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified September 29 20:23 EDT 2023. Contains 365777 sequences. (Running on oeis4.)