Elsevier

Journal of Algorithms

Volume 29, Issue 1, October 1998, Pages 165-173
Journal of Algorithms

Regular Article
Generation of Well-Formed Parenthesis Strings in Constant Worst-Case Time

https://doi.org/10.1006/jagm.1998.0960Get rights and content

Abstract

Proskurowski and Ruskey (J. Algorithms11(1990), 68–84) published a recursive algorithm for generating well-formed parenthesis strings of length 2nand challenged the reader to find a loop-free version of their algorithm. We present two nonrecursive versions of their algorithm, one of which generates each string inO(n) worst-case time and requires space for onlyO(1) extra integer variables, and the other generates each string inO(1) worst-case time and usesO(n) extra space.

References (9)

There are more references available in the full text version of this article.

Cited by (14)

  • A minimum-change version of the Chung-Feller theorem for Dyck paths

    2017, Electronic Notes in Discrete Mathematics
  • A loop-free two-close Gray-code algorithm for listing k-ary Dyck words

    2006, Journal of Discrete Algorithms
    Citation Excerpt :

    The terms minimal, homogeneous and 2-close will mean the same thing for Dyck words and their generalizations as they do for combinations. A minimal Gray code for Dyck words was published by Ruskey and A. Proskurowski [16]; a non-recursive description and a loop-free implementation of this Gray code appears in [20]. A homogeneous Gray code for Dyck words was discovered by B. Bultena and Ruskey [2].

  • Greedy Gray Codes for Dyck Words and Ballot Sequences

    2024, Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
View all citing articles on Scopus
View full text