A Note on Generating Well-formed Parenthesis Strings Lexicographically
N. C. Er · The Computer Journal · 1983
An efficient recursive algorithm for generating well-formed parenthesis strings lexicographically is shown. This algorithm can be easily adapted to generate stack-sortable permutations without changing the main control structures of the algorithm. The connection between well-formed parenthesis strings and ordered trees is also illustrated.