Open Access Open Access  Restricted Access Subscription Access

Loopless Algorithms for Listing Zaks' Sequences in Gray-Code Order

Ro-Yu Wu,
Cheng-Hsien Hsu,
Jou-Ming Chang,

Abstract


A k-ary tree is a rooted and ordered tree such that every internal node has exactly k children. A natural representation of k-ary trees is the use of z-sequences (or x-sequences) introduced by Zaks in 1980. Under such representation, loopless algorithms for generating z-sequences of k-ary trees in Gray-code order were developed by van Baronaigien (2000) and Xiang et al. (2000), respectively. In this paper, we present a new loopless algorithm to generate z-sequences of k-ary trees in Gray-code order. The development requires almost half of memory space and is shown to be more efficient than the existing algorithms by experimental results. In particular, constant upper bounds for the expected numbers of operations (e.g., assignments and comparisons) are derived. Moreover, with a slight modification, our algorithm can generate x-sequences of k-ary trees so that each successive sequence is obtained from its predecessor by changing one "0" to a "1" and one "1" to a "0."

Keywords


Loopless algorithms; Gray-Code order; Lexicographic order; k-ary trees

Citation Format:
Ro-Yu Wu, Cheng-Hsien Hsu, Jou-Ming Chang, "Loopless Algorithms for Listing Zaks' Sequences in Gray-Code Order," Journal of Internet Technology, vol. 15, no. 4 , pp. 679-684, Jul. 2014.

Full Text:

PDF

Refbacks

  • There are currently no refbacks.





Published by Executive Committee, Taiwan Academic Network, Ministry of Education, Taipei, Taiwan, R.O.C
JIT Editorial Office, Office of Library and Information Services, National Dong Hwa University
No. 1, Sec. 2, Da Hsueh Rd., Shoufeng, Hualien 974301, Taiwan, R.O.C.
Tel: +886-3-931-7314  E-mail: jit.editorial@gmail.com