Gate2018 cs Q43

0. The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is _______.

  • Option : A
  • Explanation :
    T(N) =(N-1)Ck * T(k) * T(N-k-1), where k = number of nodes on left subtree
    T(1) = 1
    T(2) = 1
    T(3) = 2
    T(4) = 3C2 * T(2) * T(1) = 3
    T(5) = 4C3 * T(3) * T(1) = 8
    T(6) = 5C3 * T(3) * T(2) = 20
    T(7) = 5C3 * T(3) * T(3) = 80
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *