Which recurrence relation correctly represents the number of distinct BSTs that can be formed using N distinct keys?

Options

  • A. C(n) = C(n-1) + 1
  • B. C(n) = 2C(n-1)
  • C. C(n) = SUM C(i)C(n-1-i)
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

C. C(n) = SUM C(i)C(n-1-i)

Detailed Explanation

The Catalan recurrence for the number of distinct BSTs is C(n) = Σ C(i)C(n−1−i), where i ranges from 0 to n−1. Each possible key can be selected as the root. The keys smaller than the root form the left subtree and the larger keys form the right subtree. The number of possible trees for that root is the product of the possibilities for the two subtrees.