Skip to main content
Log in

Loop-free algorithms for traversing binary trees

  • Part I Computer Science
  • Published:
BIT Numerical Mathematics Aims and scope Submit manuscript

Abstract

We survey and classify the various algorithms for traversing binary trees in the three principal orders and the related two- and three-visit traversal orders. For each class of algorithms we determine which of the traversal orders may be effected by means ofloop-free traversal algorithms. Although, in general, these are multi-visit traversal orders, we indicate how the algorithms may be modified to yield loop-freesingle-visit traversal algorithms in “non-standard” orders. We also exhibit and discuss the close relationship between the various stack-based algorithms and the other classes of algorithms.

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

Access this article

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. E. N. Adams III,Another representation of binary tree traversal, Information Processing Lett. 2 (1973), 52–54.

    Article  Google Scholar 

  2. K. Brinck and N. Y. Foo,Analysis of algorithms on threaded trees, Computer J. 24 (1981), 148–155.

    Article  Google Scholar 

  3. W. A. Burkhard,Nonrecursive tree traversal algorithms, in Proceedings of the 7th Annual Princeton Conference on Information Sciences & Systems (1973), 403–405.

  4. W. A. Burkhard,Nonrecursive traversals of trees, Computer J. 18 (1975), 227–230.

    Article  Google Scholar 

  5. B. Dwyer,Simple algorithms for traversing a tree without an auxiliary stack, Information Processing Lett. 2 (1974), 143–145.

    Article  Google Scholar 

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

    Article  Google Scholar 

  7. T. I. Fenner and G. Loizou,A note on traversal algorithms for triply linked binary trees, BIT 21 (1981), 153–156.

    Google Scholar 

  8. E. Horowitz and S. Sahni,Fundamentals of Computer Algorithms, Computer Science Press Inc., Potomac, Maryland, (1978).

    Google Scholar 

  9. A. C. Kilgour,Generalized non-recursive traversal of binary trees, Software — Practice and Experience 11 (1981), 1299–1306.

    Google Scholar 

  10. D. E. Knuth,Fundamental Algorithms. The Art of Computer Programming, Vol. 1, 2nd edition, Addison-Wesley, Reading, Mass., (1973).

    Google Scholar 

  11. G. Lindstrom,Scanning list structures without stacks or tag bits, Information Processing Lett. 2 (1973), 47–51.

    Article  Google Scholar 

  12. W. D. Maurer,An alternate characterization of preorder, inorder and postorder, ACM Sigplan Notices 16 (1981), 60–61.

    Google Scholar 

  13. J. M. Morris,Traversing binary trees simply and cheaply, Information Processing Lett. 9 (1979), 197–200.

    Article  Google Scholar 

  14. A. J. Perlis and C. Thornton,Symbol manipulation by threaded lists, Comm. ACM 3 (1960), 195–204.

    Article  Google Scholar 

  15. J. L. Pfaltz,Computer Data Structures, McGraw-Hill, New York, (1977).

    Google Scholar 

  16. E. M. Reingold, J. Nievergelt and N. Deo,Combinatorial Algorithms: Theory and Practice, Prentice-Hall, Englewood Cliffs, New Jersey, (1977).

    Google Scholar 

  17. J. M. Robson,An improved algorithm for traversing binary trees without auxiliary stack, Information Processing Lett. 2 (1973), 12–14.

    Article  Google Scholar 

  18. H. Schorr and W. M. Waite,An efficient machine-independent procedure for garbage collection in various list structures, Comm. ACM 10 (1967), 501–506.

    Article  Google Scholar 

  19. L. Siklóssy,Fast and read-only algorithms for traversing trees without an auxiliary stack, Information Processing Lett. 1 (1972), 149–152.

    Article  Google Scholar 

  20. S. Soule,A note on the nonrecursive traversal of binary trees, Computer J. 20 (1977), 350–352.

    Article  Google Scholar 

  21. T. A. Standish,Data Structure Techniques, Addison-Wesley, Reading, Mass., (1980).

    Google Scholar 

  22. W. A. Wulf, M. Shaw, P. N. Hilfinger and L. Flon,Fundamental Structures of Computer Science, Addison-Wesley, Reading, Mass., (1981).

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Fenner, T.I., Loizou, G. Loop-free algorithms for traversing binary trees. BIT 24, 33–44 (1984). https://doi.org/10.1007/BF01934513

Download citation

  • Received:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01934513

Keywords

Navigation