Skip Navigation

The Computer Journal 1999 42(5):400-408; doi:10.1093/comjnl/42.5.400
© 1999 by British Computer Society
This Article
Right arrow Full Text (PDF)
Right arrow Alert me when this article is cited
Right arrow Alert me if a correction is posted
Services
Right arrow Email this article to a friend
Right arrow Similar articles in this journal
Right arrow Similar articles in ISI Web of Science
Right arrow Alert me to new issues of the journal
Right arrow Add to My Personal Archive
Right arrow Download to citation manager
Right arrow Search for citing articles in:
ISI Web of Science (4)
Right arrowRequest Permissions
Google Scholar
Right arrow Articles by Takaoka, T.
Right arrow Search for Related Content
Social Bookmarking
 Add to CiteULike   Add to Connotea   Add to Del.icio.us  
What's this?

O(1) Time Algorithms for Combinatorial Generation by Tree Traversal

Tadao TakaokaA1

A1 Department of Computer Science, University of Canterbury, Christchurch, New Zealand Email: tad@cosc.canterbury.ac.nz

There are algorithms for generating combinatorial objects such as combinations, permutations and well formed parenthesis strings in O(1) time per object, in the worst case. Those known algorithms are designed based on the intrinsic nature of each problem, causing difficulty in applying a method in one area to the other. On the other hand, there are many results on combinatorial generation with minimal change order, in which just a few changes, one or two, are allowed from object to object. These results are classified in a general framework of a combinatorial Gray code, many of which are based on a recursive algorithm, causing O(n) time from object to object. To derive O(1) time algorithms for combinatorial generation systematically, we formalize the idea of combinatorial Gray code by a twisted lexico tree, which is obtained from the lexicographic tree for the given set of combinatorial objects by twisting branches depending on the parity of the nodes. An iterative algorithm which traverses this tree will generate the given set of combinatorial objects in O(1) time as well as with a fixed number of changes from the present combinatorial object to the next. Although the idea of a twisted lexico tree is not new, the mechanisms of tree traversal and computation of changing places in this paper are new. As examples of this approach, we present new algorithms for generating well formed parenthesis strings and combinations in O(1) time per object. The generation of combinations is done ‘in-place’, that is, taking O(n) space to generate combinations of n elements out of r elements. Previous algorithms take O(r) space to represent a combination by a binary vector of size r.


Received 1 December, 1998. Revised 18 June, 1999.


Add to CiteULike CiteULike   Add to Connotea Connotea   Add to Del.icio.us Del.icio.us    What's this?




Disclaimer:
Please note that abstracts for content published before 1996 were created through digital scanning and may therefore not exactly replicate the text of the original print issues. All efforts have been made to ensure accuracy, but the Publisher will not be held responsible for any remaining inaccuracies. If you require any further clarification, please contact our Customer Services Department.