![]() |
VOOZH | about |
Catalan numbers are a sequence of natural numbers that appear in various counting problems, often related to recursive structures. They are named after the French-Belgian mathematician Eugène Charles Catalan.
These numbers have applications in combinatorial mathematics, such as counting paths, tree structures, and polygon triangulations.
The first few Catalan numbers are given here,
1, 1, 2, 5, 14, 42, 132, 429, 4862, 16796, .....,
The n-th Catalan number Cn can be calculated using the following formula:
Where n is a non-negative integer, and the factorial symbol "!" represents the product of all positive integers less than or equal to that number.
Alternatively, you can use the binomial coefficient:
Let's calculate the first few Catalan numbers:
So, the first few Catalan numbers are: 1, 1, 2, 5, 14, 42, ….,Catalan numbers arise in several combinatorial problems, including:
Question 1. How many valid parentheses, expressions can be formed with 4 pairs of parentheses?
Solution:
The number of valid parenthesis expressions for nnn pairs of parentheses is given by the n-th Catalan number,
The formula for the n-th Catalan number is:
For 4 pairs of parentheses, n = 4.
So, there are 14 valid parenthesis expressions that can be formed with 4 pairs of parentheses.
Question 2. How many distinct binary search trees can be formed with 3 nodes?
Solution:
The number of distinct binary search trees (BSTs) that can be formed with n nodes is the n-th Catalan number.
For n = 3, we can use the Catalan number formula to find the solution.
Thus, there are 5 distinct binary search trees that can be formed with 3 nodes.
Question 1. Find the 5th Catalan number?
Question 2. How many distinct binary search trees can be formed with 4 nodes?
Question 3. Calculate the 3rd Catalan number?
Question 4. How many valid parentheses expressions can be formed with 2 pairs of parentheses?
Answer:-
1) 42
2) 14
3) 5
4) 2