Skip to main content

A Constant Amortized Time Algorithm for Generating Left-Child Sequences in Lexicographic Order

  • Conference paper
  • First Online:
Frontiers in Algorithmics (FAW 2017)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 10336))

Included in the following conference series:

  • 515 Accesses

Abstract

Wu et al. (Theoret. Comput. Sci. 556:25–33, 2014) recently introduced a new type of sequences, called left-child sequences (LC-sequences for short), for representing binary trees. They pointed out that such sequences have a natural interpretation from the view point of data structure and gave a characterization of them. Based on this characterization, Pai et al. (International conference on combinatorial optimization and applications. Springer, Cham, pp. 505–518, 2016) showed that there is an easily implementing algorithm that uses generate-and-test approach to filter all LC-sequences of binary trees with n internal nodes in lexicographic order, while in general this algorithm is not efficient at all. In this paper, we design two novel rotations that allow us to drastically alter the shape of binary trees (and thus their corresponding LC-sequences). As an application, these operations can be employed to generate all LC-sequences in lexicographic order. Accordingly, we present a more efficient algorithm associated with the new types of rotations for generating all LC-sequences and show that it takes only constant amortized running cost.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Adamchuk, A.: A014138. The On-Line Encyclopedia of Integer Sequences (2006). http://oeis.org/A014138

  2. Boyer, J.M.: Simple constant amortized time generation of fixed length numeric partitions. J. Algorithms 54, 31–39 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  3. Effler, S., Ruskey, F.: A CAT algorithm for generating permutations with a fixed number of inversions. Inform. Process. Lett. 86, 107–112 (2003)

    Article  MathSciNet  MATH  Google Scholar 

  4. Ehrlich, G.: Loopless algorithms for generating permutations, combinations, and other combinatorial configurations. J. ACM 20, 500–513 (1973)

    Article  MathSciNet  MATH  Google Scholar 

  5. Gibbons, A., Sant, P.: Rotation sequences and edge-colouring of binary tree pairs. Theor. Comput. Sci. 326, 409–418 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  6. Guibas, L., Hershberger, J., Suri, S.: Morphing simple polygons. Discret. Comput. Geometry 24, 1–34 (2000)

    Article  MathSciNet  MATH  Google Scholar 

  7. Hershberger, J., Suri, S.: Morphing binary trees. In: Proceedings of the ACM-SIAM Sixth Annual Symposium on Discrete Algorithms (SODA), pp. 396–404 (1995)

    Google Scholar 

  8. Kensler, A.: Tree rotations for improving bounding volume hierarchies. In: IEEE Symposium on Interactive Ray Tracing, pp. 73–76. IEEE Computer Society, Washington (2008)

    Google Scholar 

  9. Knuth, D.E.: The Art of Computer Programming. Fascicle 4A - Generating All Trees, vol. 4. Addison-Wesley, Boston (2005)

    MATH  Google Scholar 

  10. Lucas, J.M., van Baronaigien, D.R., Ruskey, F.: On rotations and the generation of binary trees. J. Algorithms 15, 343–366 (1993)

    Article  MathSciNet  MATH  Google Scholar 

  11. Mäkinen, E.: A survey on binary tree codings. Comput. J. 34, 438–443 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  12. Pai, K.-J., Wu, R.-Y., Chang, J.-M., Chang, S.-C.: Amortized efficiency of ranking and unranking left-child sequences in lexicographic order. In: Chan, T.H., Li, M., Wang, L. (eds.) COCOA 2016. LNCS, vol. 10043, pp. 505–518. Springer, Cham (2016). doi:10.1007/978-3-319-48749-6_37

    Chapter  Google Scholar 

  13. Pallo, J.: Enumerating, ranking and unranking binary trees. Comput. J. 29, 171–175 (1986)

    Article  MathSciNet  MATH  Google Scholar 

  14. Proskurowski, A., Ruskey, F.: Binary tree Gray codes. J. Algorithms 6, 225–238 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  15. van Baronaigien, D.R.: A loopless algorithm for generating binary tree sequences. Inform. Process. Lett. 39, 189–194 (1991)

    Article  MathSciNet  MATH  Google Scholar 

  16. Ruskey, F., Hu, T.C.: Generating binary trees lexicographically. SIAM J. Comput. 6, 745–758 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  17. Savage, C.D.: A survey of combinatorial Gray codes. SIAM Rev. 39, 605–629 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  18. Sawada, J.: Generating bracelets in constant amortized time. SIAM Comput. 31, 259–268 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  19. Vajnovszki, V.: On the loopless generation of binary tree sequences. Inform. Process. Lett. 68, 113–117 (1998)

    Article  MathSciNet  MATH  Google Scholar 

  20. Wu, R.-Y., Chang, J.-M., Chan, H.-C., Pai, K.-J.: A loopless algorithm for generating multiple binary tree sequences simultaneously. Theoret. Comput. Sci. 556, 25–33 (2014)

    Article  MathSciNet  MATH  Google Scholar 

  21. Wu, R.-Y., Chang, J.-M., Wang, Y.-L.: A linear time algorithm for binary tree sequences transformation using left-arm and right-arm rotations. Theoret. Comput. Sci. 355, 303–314 (2006)

    Article  MathSciNet  MATH  Google Scholar 

  22. Zaks, S.: Lexicographic generation of ordered trees. Theoret. Comput. Sci. 10, 63–82 (1980)

    Article  MathSciNet  MATH  Google Scholar 

  23. Zaks, S., Richards, D.: Generating trees and other combinatorial objects lexicographically. SIAM J. Comput. 8, 73–81 (1979)

    Article  MathSciNet  MATH  Google Scholar 

  24. Zumkeller, R.: A014138. The On-Line Encyclopedia of Integer Sequences (2010). http://oeis.org/A014138

Download references

Acknowledgments

This research was partially supported by MOST grants MOST 105-2221-E-131-027 (Kung-Jui Pai), 104-2221-E-141-002-MY3 (Jou-Ming Chang) and 104-2221-E-262-005 (Ro-Yu Wu) from the Ministry of Science and Technology, Taiwan.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jou-Ming Chang .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this paper

Cite this paper

Pai, KJ., Chang, JM., Wu, RY. (2017). A Constant Amortized Time Algorithm for Generating Left-Child Sequences in Lexicographic Order. In: Xiao, M., Rosamond, F. (eds) Frontiers in Algorithmics. FAW 2017. Lecture Notes in Computer Science(), vol 10336. Springer, Cham. https://doi.org/10.1007/978-3-319-59605-1_20

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-59605-1_20

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-59604-4

  • Online ISBN: 978-3-319-59605-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics