The question is that you have to print all the valid permutations of the given number of brackets for example for input 3 we have the output
1 ((())) 2 (()()) 3 (())() 4 ()(()) 5 ()()() total five valid permutation this can be solved in O( 2^(2n) ) where n is number of brackets . Algo will be like this 1. Try '(' and ')' in every position and print the correct permutation.Neglect all other permutation As catalon number is far less then exponential growth ,can anybody suggest some better algorithm -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.