An Eades-McKay algorithm for well-formed parentheses strings

被引:8
作者
Bultena, B [1 ]
Ruskey, F [1 ]
机构
[1] Univ Victoria, Dept Comp Sci, Victoria, BC V8W 3P6, Canada
关键词
parentheses strings; gray code; transposition; combination; algorithms;
D O I
10.1016/S0020-0190(98)00171-9
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
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 (1984) 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. (C) 1998 Elsevier Science B.V. All rights reserved.
引用
收藏
页码:255 / 259
页数:5
相关论文
共 10 条
[1]  
Akl S. G., 1996, Nordic Journal of Computing, V3, P63
[2]  
Chase P., 1989, Congr. Numer., V69, P215
[3]   SOME HAMILTON PATHS AND A MINIMAL CHANGE ALGORITHM [J].
EADES, P ;
HICKEY, M ;
READ, RC .
JOURNAL OF THE ACM, 1984, 31 (01) :19-29
[4]   AN ALGORITHM FOR GENERATING SUBSETS OF FIXED SIZE WITH A STRONG MINIMAL CHANGE PROPERTY [J].
EADES, P ;
MCKAY, B .
INFORMATION PROCESSING LETTERS, 1984, 19 (03) :131-133
[5]   ON ROTATIONS AND THE GENERATION OF BINARY-TREES [J].
LUCAS, JM ;
VANBARONAIGIEN, DR ;
RUSKEY, F .
JOURNAL OF ALGORITHMS, 1993, 15 (03) :343-366
[6]   A SURVEY ON BINARY-TREE CODINGS [J].
MAKINEN, E .
COMPUTER JOURNAL, 1991, 34 (05) :438-443
[7]   GENERATING BINARY-TREES BY TRANSPOSITIONS [J].
RUSKEY, F ;
PROSKUROWSKI, A .
JOURNAL OF ALGORITHMS, 1990, 11 (01) :68-84
[8]  
RUSKEY F, 1993, LECT NOTES COMPUT SC, V762, P201
[9]  
RUSKEY F, UNPUB COMBINATORIAL
[10]   LEXICOGRAPHIC GENERATION OF ORDERED TREES [J].
ZAKS, S .
THEORETICAL COMPUTER SCIENCE, 1980, 10 (01) :63-82