Given an input n write a program to generate all possible parenthesizing.
For ex: if n=3, then following is the result
((()))
(())()
()()()
(()())
()(())
Number of such elements is represented as Catalan Number. For more details, see http://en.wikipedia.org/wiki/Catalan_number
A similar problem asks to find all possible permutations of given elements with following two variations:
1. There might be repetitions
2. All elements are unique
1 year ago
No comments:
Post a Comment