In how many ways can the string $A \cap B - A \cap B -A$ be fully paranthesized to yield an infix expression?
formula is 1/N * 2(N-1)C(N-1)
where N is number of operands
=1/5 * 8C4
Either of the four operators can be the outermost one, so there are four cases to consider. If the first operator is the outermost one, then we need to compute the number of ways to fully parenthesize B - An B - A. Here there are 5 possibilities: 1 in which the "n" symbol is the outermost operator and 2 with each of the " - " symbols as the outermost operator. If the second operator in our original expression is the outermost one, then the only choice is in the parenthesization of the second of its operands, and there are 2 possibilities. Thus there are a total 7 ways to parenthesize this expression if either of the first two operators are the outermost one. By symmetry there are another 7 if the outermost operator is one of the last two. Therefore the answer to the problem is 14.
64.3k questions
77.9k answers
244k comments
80.0k users