<p>I came up with the following algorithm which is not recursive as requested by the OP but it is worth mentioning given its <em>invincible efficiency</em>.</p>

<p>As said in <a href="https://stackoverflow.com/users/4200/ed-guiness">Ed Guiness'</a> <a href="https://stackoverflow.com/a/4314310/1137388">post</a>, strings of <code>N</code> pairs of correctly matched parentheses is a representation of a Dyck word. In another useful representation,  parentheses <code>(</code> and <code>)</code> are replaced with <code>1</code> and <code>0</code> respectively. Hence, <code>()()()</code> becomes <code>101010</code>. The latter can also be seen as the binary representation of (decimal) number <code>42</code>. In summary, some integer numbers can represent strings of correctly matched pairs of parentheses. Using this representation the following is an efficient algorithm to generate Dyck works.</p>

<p>Let <code>integer</code> be any C/C++ (or, possibly, and member of the the <a href="https://en.wikipedia.org/wiki/List_of_C-family_programming_languages" rel="nofollow noreferrer">C-family programming languages</a>) unsigned integer type up to 64-bits long. Given a Dyck word the following code returns the next Dyck word of the same size, provided it exists.</p>

<pre><code>integer next_dyck_word(integer w) {
    integer const a = w &amp; -w;
    integer const b = w + a;
    integer c = w ^ b;
    c = (c / a &gt;&gt; 2) + 1;
    c = ((c * c - 1) &amp; 0xaaaaaaaaaaaaaaaa) | b;
    return c;
} 
</code></pre>

<p>For instance, if <code>w == 42</code> (<code>101010</code> in binary, i.e., <code>()()()</code>) the function returns <code>44</code> (<code>101100</code>, <code>()(())</code>). One can iterate until getting <code>56</code> (<code>111000</code>, <code>((()))</code>) which is the maximum Dyck word for <code>N == 3</code>.</p>

<p>Above, I've mentioned <em>invincible efficiency</em> because, as far as generation of a single Dyck word is concerned, this algorithm is O(1), loopless and branchless. However, the implementation still has room for improvement. Indeed, the relatively expensive division <code>c / a</code> in the body of the function can be eliminated if we can use some assembly instructions that are not available in strict Standard compliant C/C++.</p>

<p>You might say. "<em>Objection! I do not want to be constraint to <code>N &lt;= 64</code></em>". Well, my answer to that is that if you want to generate all Dyck works, then in practice you  are already bound to a much lower size than <code>64</code>. Indeed, <a href="https://en.wikipedia.org/wiki/Catalan_number" rel="nofollow noreferrer">the number of Dyck works of size <code>N</code></a> grows factorially with <code>N</code> and for <code>N == 64</code> the time to generate them all is likely to be greater than the age of the universe. (I confess I did not calculate this time but this is a quite common anecdotal feature of problems of this nature.)</p>

<p>I've written a <a href="https://arxiv.org/abs/1602.06426" rel="nofollow noreferrer">detailed document on the algorithm</a>.</p>
Recurrence Approach : How can we generate all possibilities on braces?
<p>How can we generate all possibilities on braces  ?</p>

<p>N value has given to us and we have to  generate all possibilities. </p>

<p><strong>Examples:</strong></p>

<p>1) if N == 1,  then only one possibility () .</p>

<p>2) if N==2, then possibilities are (()), ()()</p>

<p>3) if N==3, then possibilities are ((())), (())(),()()(), ()(()) ... </p>

<p>Note: left and right braces should match. I mean )( is INVALID for the N==1 </p>

<p>Can we solve this problem by using recurrence approach ? </p>