Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

number of Parenthesizations for fixed number of "()" pairs

Say we'd like to count the number of different parenthesizations of n pairs of brackets but having a fixed number of "()" pairs. How do we count these.

ex: for n = 3. i.e 3 pairs of parenthesizations, if we want number of parenthizations with k = 2 pairs of "()" the number of ways is 3.

()(())

(())()

(()())

for n = 4,k = 2, it will be 6

((()()))

()((()))

(())(())

(()(()))

((()))()

((())())

like image 470
kash Avatar asked Nov 12 '22 20:11

kash


1 Answers

I'm pretty sure this is A001263, a.k.a. the Narayana numbers, and that the formula is

T(n,k) = C(n-1,k-1) C(n,k-1)/k with 1<=k<=n

One interpretation of A001263 is that T(n,k) is the number of Dyck n-paths with exactly k peaks, and you can interpret each Dyck step as either ( or ) and each peak as ().

like image 148
DSM Avatar answered Nov 22 '22 11:11

DSM