首页 | 本学科首页   官方微博 | 高级检索  
相似文献
 共查询到20条相似文献,搜索用时 62 毫秒
1.
In this paper the problem of generating all binary trees, as represented by well-formed parentheses strings, in such a way that the changes in successively generated trees are constant is discussed. In particular, an algorithm is developed that generates the strings by simply interchanging a left and a right parenthesis. It is also proven that it is impossible to generate all trees by interchanging an adjacent left and right (or right and left) parenthesis pair. The Appendix contains a Pascal program that implements the generation algorithm. Also, ranking and unranking algorithms are given.  相似文献   

2.
3.
The generation of efficient Gray codes and combinatorial algorithms that list all the members of a combinatorial object has received a lot of attention in the last few years. Knuth gave a code for the set of all partitions of [n] = {1,2,...,n}. Ruskey presented a modified version of Knuth’s algorithm with distance 2. Ehrlich introduced a looplees algorithm for the set of the partitions of [n]; Ruskey and Savage generalized Ehrlich’s results and introduced two Gray codes for the set of partitions of [n]. In this paper, we give another combinatorial Gray code for the set of the partitions of [n] which differs from the aforementioned Gray codes. Also, we construct a different loopless algorithm for generating the set of all partitions of [n] which gives a constant time between successive partitions in the construction process.   相似文献   

4.
We give the first Gray code for the set of n-length permutations with a given number of cycles. In this code, each permutation is transformed into its successor by a product with a cycle of length three, which is optimal. If we represent each permutation by its transposition array then the obtained list still remains a Gray code and this allows us to construct a constant amortized time (CAT) algorithm for generating these codes. Also, Gray code and generating algorithm for n-length permutations with fixed number of left-to-right minima are discussed.  相似文献   

5.
We give a Gray code and constant average time generating algorithm for derangements, i.e., permutations with no fixed points. In our Gray code, each derangement is transformed into its successor either via one or two transpositions or a rotation of three elements. We generalize these results to permutations with number of fixed points bounded between two constants.  相似文献   

6.
Korsh  James F.  LaFollette  Paul S. 《Order》2002,19(2):115-126
Canfield and Williamson gave the first loopless algorithm for generating all linear extensions of a poset. It elegantly generates all signed extensions, resulting in each extension appearing somewhere with each sign, but retains only every other one independent of its sign. It uses an array for the extension. In this paper we give another loopless algorithm for generating all the linear extensions. It generates each extension only once and uses a list for the extensions.  相似文献   

7.
An indecomposable permutation π on [n] is one such that π([m])=[m] for no m<n. We consider indecomposable permutations and give a new, inclusive enumerative recurrence for them. This recurrence allows us to generate all indecomposable permutations of length n in transposition Gray code order, in constant amortized time (CAT). We also present a CAT generation algorithm for indecomposable permutations which is based on the Johnson-Trotter algorithm for generating all permutations of length n. The question of whether or not there exists an adjacent transposition Gray code for indecomposable permutations remains open.  相似文献   

8.
A bubble language is a set of binary strings with a simple closure property: The first 01 of any string can be replaced by 10 to obtain another string in the set. Natural representations of many combinatorial objects are bubble languages. Examples include binary string representations of k-ary trees, unit interval graphs, linear-extensions of B-posets, binary necklaces and Lyndon words, and feasible solutions to knapsack problems. In co-lexicographic order, fixed-weight binary strings are ordered so that their suffixes of the form i10 occur (recursively) in the order i=max,max−1,…,min+1,min for some values of max and min. In cool-lex order the suffixes occur (recursively) in the order max−1,…,min+1,min,max. This small change has significant consequences. We prove that the strings in any bubble language appear in a Gray code order when listed in cool-lex order. This Gray code may be viewed from two different perspectives. On one hand, successive binary strings differ by one or two transpositions, and on the other hand, they differ by a shift of some substring one position to the right. This article also provides the theoretical foundation for many efficient generation algorithms, as well as the first construction of fixed-weight binary de Bruijn sequences; results that will appear in subsequent articles.  相似文献   

9.
We present a practical and elegant method for generating all (s,t)-combinations (binary strings with s zeros and t ones): Identify the shortest prefix ending in 010 or 011 (or the entire string if no such prefix exists), and rotate it by one position to the right. This iterative rule gives an order to (s,t)-combinations that is circular and genlex. Moreover, the rotated portion of the string always contains at most four contiguous runs of zeros and ones, so every iteration can be achieved by transposing at most two pairs of bits. This leads to an efficient loopless and branchless implementation that consists only of two variables and six assignment statements. The order also has a number of striking similarities to colex order, especially its recursive definition and ranking algorithm. In the light of these similarities we have named our order cool-lex!  相似文献   

10.
Many applications call for exhaustive lists of strings subject to various constraints, such as inequivalence under group actions. A k-ary necklace is an equivalence class of k-ary strings under rotation (the cyclic group). A k-ary unlabeled necklace is an equivalence class of k-ary strings under rotation and permutation of alphabet symbols. We present new, fast, simple, recursive algorithms for generating (i.e., listing) all necklaces and binary unlabeled necklaces. These algorithms have optimal running times in the sense that their running times are proportional to the number of necklaces produced. The algorithm for generating necklaces can be used as the basis for efficiently generating many other equivalence classes of strings under rotation and has been applied to generating bracelets, fixed density necklaces, and chord diagrams. As another application, we describe the implementation of a fast algorithm for listing all degree n irreducible and primitive polynomials over GF(2).  相似文献   

11.
LaFollette  Paul S.  Korsh  James F. 《Order》2000,17(3):271-285
Erhlich introduced the concept of generating combinatorial structures in constant time per generated item. Such algorithms are called loopless and have been described for many objects. Myers introduced the idea of a basic minimal interval order. This paper presents a loopless algorithm for generating basic minimal interval orders.  相似文献   

12.
We present several efficient algorithms on distributive lattices. They are based on a compact representation of the lattice, called the ideal tree. This allows us to exploit regularities in the structure of distributive lattices. The algorithms include a linear-time algorithm to reconstruct the covering graph of a distributive lattice from its ideal tree, a linear-time incremental algorithm for building the ideal lattice of a poset and a new incremental algorithm for listing the ideals of a poset in a combinatorial Gray code manner (in an code.)  相似文献   

13.
《Discrete Mathematics》2023,346(1):113168
We present a simple algorithm that generates a cyclic 2-Gray code for ballot sequences. The algorithm generates each ballot sequence in constant amortized time using a linear amount of space. This is the first known cyclic 2-Gray code for ballot sequences that achieves this time bound. In addition, the algorithm can be easily modified to output ballot sequences in binary reflected Gray code order in constant amortized time per string using a linear amount of space.  相似文献   

14.
记环R=F_(p~k)+uF_(p~k)+u~2F_(p~k),定义了一个从R~n到F_(p~k)~(2np~k)的Gray映射.利用Gray映射的性质,研究了环R上(1-u~2)-循环码和循环码.证明了环R上码是(1-u~2)-循环码当且仅当它的Gray象是F_(p~k)上的准循环码.当(n,p)=1时,证明了环R上的长为n的线性循环码的Gray象置换等价于域F_(p~k)上的线性准循环码.  相似文献   

15.
P. Chase and F. Ruskey each published a Gray code for length n binary strings with m occurrences of 1, coding m-combinations of n objects, which is two-close—that is, in passing from one binary string to its successor a single 1 exchanges positions with a 0 which is either adjacent to the 1 or separated from it by a single 0. If we impose the restriction that any suffix of a string contains at least k−1 times as many 0's as 1's, we obtain k-suffixes: suffixes of k-ary Dyck words. Combinations are retrieved as special case by setting k=1 and k-ary Dyck words are retrieved as a special case by imposing the additional condition that the entire string has exactly k−1 times as many 0's as 1's. We generalize Ruskey's Gray code to the first two-close Gray code for k-suffixes and we provide a loop-free implementation for k2. For k=1 we use a simplified version of Chase's loop-free algorithm for generating his two-close Gray code for combinations. These results are optimal in the sense that there does not always exist a Gray code, either for combinations or Dyck words, in which the 1 and the 0 that exchange positions are adjacent.  相似文献   

16.
This paper deals with the optimization of 2D finite element shapes using the very promising methods based on genetic algorithms. The codification of the design variables is carried out by generating series of strings in binary code. Classical genetic operators such as crossover, mutation and reproduction are used for the optimization process. A more refined operators needed to improve the performance of the process are used as well. Some illustrative examples are presented and discussed  相似文献   

17.
记R=Z_p[u]/(u~(k+1)),定义了从R~n到Z_p~(np~k)的Gray映射.利用Gray映射的性质,研究了环R上任意长循环码.证明了环R上任意长码是循环码当且仅当它的Gray象是域Z_p上的准循环码.特别的,环R上的线性循环码的Gray象是Z_p上的线性准循环码.  相似文献   

18.
This paper studies several topics concerning the way strings can overlap. The key notion of the correlation of two strings is introduced, which is a representation of how the second string can overlap into the first. This notion is then used to state and prove a formula for the generating function that enumerates the q-ary strings of length n which contain none of a given finite set of patterns. Various generalizations of this basic result are also discussed. This formula is next used to study a wide variety of seemingly unrelated problems. The first application is to the nontransitive dominance relations arising out of a probabilistic coin-tossing game. Another application shows that no algorithm can check for the presence of a given pattern in a text without examining essentially all characters of the text in the worst case. Finally, a class of polynomials arising in connection with the main result are shown to be irreducible.  相似文献   

19.
A Gray code of size n is a cyclic sequence of all binary words of length n such that two consecutive words differ exactly in one position. We say that the Gray code is a distance code if the Hamming distance between words located at distance k from each other is equal to d. The distance property generalizes the familiar concepts of a locally balanced Gray code. We prove that there are no distance Gray codes with d = 1 for k > 1. Some examples of constructing distance Gray codes are given. For one infinite series of parameters, it is proved that there are no distance Gray codes.  相似文献   

20.
研究了一类星形弹性网络系统在热效应影响以及边界反馈作用下的稳定性问题及系统相应(广义)特征向量的Riesz基性质.基于Green和Naghdi第二类热弹性理论,假设在该热弹性系统中热以有限波速传播,并且在传播过程中无能量耗散.证明了该热弹性网络系统能量渐近衰减到零.并进一步通过系统算子谱分析,讨论得出该系统算子的(广义)特征向量构成状态空间的一组Riesz基.  相似文献   

设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号