Monday, September 27, 2010

catalon number

In how many different ways can you put brackets properly using only curly braces only for n times?
For eg:
If n = 1 => {} Only 1 is possible
If n = 2 => {}{}, {{}} 2 are possible


Answer: Use catalon number c(2n n)n/(n+1).

No comments:

Post a Comment