4 research outputs found

    An Eades-McKay Algorithm for Well-Formed Parentheses Strings

    No full text
    Let T(n) be the set of all well-formed parentheses strings of length 2n. We show that the elements of T(n) can be listed so that successive strings differ by the transposition of a left and a right parenthesis. Furthermore, between the two parentheses that are transposed, only left parentheses occur. Our listing is a modification of the well-known Eades-McKay [4] algorithm for generating combinations. Like that algorithm, ours generates strings from the lexicographically greatest string to the lexicographically least and can be implemented so that each string is generated in constant time, in an amortized sense. 1 Introduction Among the classes of strings studied by mathematicians and computer scientists, perhaps none has been examined so intensely as the class of well-formed parentheses strings. There is a natural correspondence, right parentheses to internal nodes and left parentheses to leaves, between these strings and extended binary trees. As a consequence, one representation is..

    An Eades-McKay algorithm for well-formed parentheses strings

    No full text

    Subset-lex: did we miss an order?

    Full text link
    We generalize a well-known algorithm for the generation of all subsets of a set in lexicographic order with respect to the sets as lists of elements (subset-lex order). We obtain algorithms for various combinatorial objects such as the subsets of a multiset, compositions and partitions represented as lists of parts, and for certain restricted growth strings. The algorithms are often loopless and require at most one extra variable for the computation of the next object. The performance of the algorithms is very competitive even when not loopless. A Gray code corresponding to the subset-lex order and a Gray code for compositions that was found during this work are described.Comment: Two obvious errors corrected (indicated by "Correction:" in the LaTeX source
    corecore