skip to main content
10.1145/268084.268114acmconferencesArticle/Chapter ViewAbstractPublication PagessigcseConference Proceedingsconference-collections
Article
Free Access

A model C++ tree iterator class for binary search trees

Published:01 March 1997Publication History

ABSTRACT

In object-oriented design, the concept of a container class that holds a collection of similar objects is fundamental. To use a container class most effectively, it is helpful to define one or more associated iterator classes that can return the objects in the container class in a specified order. An iterator is a bridge that permits the caller to use the objects in a container without knowledge of the details of how the objects are stored in the container. Although the concept of iterator is discussed in a number of books on C++ and/or object-oriented design, it is difficult to find a complete example that is both elegant and sophisticated. In this article, we provide such an example by developing an iterator class for binary search trees that is capable of doing all standard traversals: inorder, preorder, and postorder.

References

  1. 1.Cline, Marshall P. and Lomow, Greg A., C++ FAQS: Frequently Asked Questions, Addison-Wesley, Reading, MA, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2.Coplien, James O., Advanced C++ Programming Styles and idioms, Addison-Wesley, Reading, MA, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3.Eckel, Bruce, Thinking in C++, Prentice Hall, Englewood Cliffs, NJ, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4.Ellis, Margaret A. and Stroustrup, Bjarne, The Annotated C++ Reference Manual, ANSI Base Document, Addison-Wesley, Reading, MA, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5.Murray, Robert B., C++ Strategies and Tactics, Addison-Wesley, Reading, MA, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6.Meyers, Scott, Effective C++: 50 Specific Ways to Improve Your Programs and Designs, Addison-Wesley, Reading, MA, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7.Musser, David and Saini, Atul, STL Tutorial a~rl Reference Guide: C++ Programming with the Standard Template Library, Addison-Wesley, Reading, MAt 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8.Stroustrup, Bjarne, The C++ Programmh~g Language, 2nd Edition, Addison-Wesley, Reading, MA, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9.Stroustrup, Bjarne, The Design and Evolution of 6'++, Addison-Wesley, Reading, MA, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A model C++ tree iterator class for binary search trees

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in
          • Published in

            cover image ACM Conferences
            SIGCSE '97: Proceedings of the twenty-eighth SIGCSE technical symposium on Computer science education
            March 1997
            410 pages
            ISBN:0897918894
            DOI:10.1145/268084

            Copyright © 1997 ACM

            Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 1 March 1997

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • Article

            Acceptance Rates

            SIGCSE '97 Paper Acceptance Rate75of177submissions,42%Overall Acceptance Rate1,595of4,542submissions,35%

            Upcoming Conference

            SIGCSE Virtual 2024

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader