number of binary heaps from 1..n

Viewed 2689

Given the integers from 1 to n, determine how many valid binary heaps can be constructed with these numbers.

Example: 1 2 3 4

valid min heaps are: {1 2 3 4}, {1 3 2 4}, {1 2 4 3},

Thus the answer is 3

1 Answers
Related