Zig-Zag World of Algorithm and Data Structures
Home
Home
Basic Data Structures
Advance Data Structures
Algorithms
Exercises
Interview Questions
Puzzles
Design Questions
Conferences and Papers
About The Blog
Wednesday, September 9, 2020
Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n?
Approach:
Should be equal to nth Catalan number.
public int NumTrees(int n)
{
return
Catalan
(n);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment