748 views
Find the number of binary strings $w$ of length $2n$ with an equal number of $1's$ and $0's$ and the property that every prefix of $w$ has at least as many $0's$ as $1's.$
retagged | 748 views
0
sir , am not getting question... one side ,says no of 0 and 1 are equal then w and prefix ..not getting
+1
it was a typo- the property must hold in every prefix of string- "100" is not allowed as for the prefix "1" the property is violated.

Answer to a is $\frac{^{2n}C_n}{(n+1)}$ which is the Catalan number.

This is also equal to the number of possible combinations of balanced parenthesizes.

See the 5th proof here http://en.wikipedia.org/wiki/Catalan_number

edited
0
The "prefix" condition is not there.
0
Not able to understand that proof, can you explain , how "number of possible combinations of balanced parenthesizes. " == This problem  in easy words ?
+24

balanced parenthesis mean equal no of left parenthesis, (  and ) , right parenthesis and ) cannot more than  ( in any "prefix" . means strings like ) , )),  ()) , (())) ,()))( are not allowed.

strings will be as (),()(), ((())),((()()()))  and so on .

in above problem ( means 0 and ) means 1.

0
Thanks got it :)
0
r u considering even or odd length prefix @praveen sir ?? i am little confused ...
0
@Puja Mishra, The condition in the question will satisfy for any valid prefix (not only of even or odd length) of w as long as w is balanced. You can check it with any valid w.
0
cant i say that it is referring even length prefixes ...??
0
Why only even length ? Consider ((())), here one of the prefix is ((( or 0's and no of zeroes greater than 1's.
0
bt the question states that

the property that every prefix of ww has at least as many 0′s0′s as 1′s. then is it valid??
+6
at least as many as 0's as 1's

means 01 ,0011,00011,000011 are valid string

but 011,10,11 are not valid string
+1
Thank u very much ... i hav to read the question more minutely ...
0
00011,000011 these are not valid string @srestha as they don't satisfy the string property for the equal number of 0's & 1's. "at least as many as 0's as 1's" property is for prefixes of the obtained string.
0

bhuv so the question requirement is

1) even length string
2) equal number of 0's and 1's
3) balanced parenthesis 0 is ( and 1 is )

am i right?

+1
@Mk Utkarsh

first two conditions are on string 'w' and
"at least as many as 0's as 1's" property is for prefixes of the obtained string 'w'.

w=0011
a)even in length
b)equal no. of 0's and 1's
c) checking prefixes of 0011
{},{0},{00},{001},{0011}
All prefixes contain at least as many 0's as 1's.

w=0011 is a valid string.
0
@bhuv

i'm  not getting this line

All prefixes contain at least as many 0's as 1's.

{0011} this is valid why??
0
0011 is valid because {},{0},{00},{001},{0011} in all these prefixes number of 0's $\geq$ number of 1's
0
1100 is not valid because there exist prefixes like {11},{110},{1} which violate the condition mentioned
0
at least means(Kam se kam  one 0 more than 1 right) but 0011 violated the condition??
0
it simply means every prefix should follow this condition $\left | 0's \right | \geq \left | 1's \right |$