I was wondering if anyone can answer me which is number of results generated in the backtracking solution for the next problem:
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
For example, given n = 3, a solution set is:
"((()))", "(()())", "(())()", "()(())", "()()()"
There is a related post in stackoverflow: Generate balanced parentheses in java
My doubt if that if there is a formula that can give me the number of valid parentheses I can generate before compute them.
for example:
- f(n):
- f(1) = 1
- f(2) = 2
- f(3) = 5
and so on..
Thank you.