1.

Which of the following gives the total number of ways of parenthesizing an expression with n + 1 terms?(a) n factorial(b) n square(c) n cube(d) nth catalan numberI had been asked this question in a job interview.My doubt is from Counting Boolean Parenthesizations in section Dynamic Programming of Data Structures & Algorithms II

Answer»

The CORRECT CHOICE is (d) nth catalan number

To explain: The nth Catalan number gives the total number of WAYS of parenthesizing an expression with n + 1 terms.



Discussion

No Comment Found

Related InterviewSolutions