Tree, Medium
Question
Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n?
Example:
|
|
Answer
|
|
|
|
Time complexity: O(n)
$ C_{n+1} = C_{n-i} * C_i $
the range of i is 0~n
Anne.github.io
Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n?
Example:
|
|
|
|
|
|
Time complexity: O(n)
$ C_{n+1} = C_{n-i} * C_i $
the range of i is 0~n