17_trees_II - CSCI-1200 Data Structures - Fall 2010 Lecture...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI-1200 Data Structures — Fall 2010 Lecture 17 – Trees, Part II Announcements Oct 11th @ 4pm in the CBIS Auditorium (the auditorium on the west end of the Biotech center). http://www.cs.rpi.edu/news/flaherty/2010Liskov.pdf Talk Title: The Power of Abstraction Talk Abstract: Abstraction is at the center of much work in Computer Science. It encompasses finding the right interface for a system as well as finding an effective design for a system implementation. Furthermore, abstraction is the basis for program construction, allowing programs to be built in a modular fashion. This talk will discuss how the abstraction mechanisms we use today came to be, how they are supported in programming languages, and some possible areas for future research. Review from Lecture 16 STL set container class (like STL map , but without the pairs!) Overview of the ds set implementation and the begin and find operations. Today’s Lecture ds set operations: insert, destroy, printing, erase Limitations of our ds set implementation 17.1 ds set : Class Overview There is an auxiliary TreeNode class, and a tree_iterator class. The classes are templated. The only member variables of the ds_set class are the root and the size (number of tree nodes). The iterator class is declared internally, and is effectively a wrapper on the TreeNode pointers. Note that operator* returns a const reference because the keys can’t change. As just discussed the increment and decrement operators are missing. The main public member functions just call a private (and often recursive) member function (passing the root node) that does all of the work. Because the class stores and manages dynamically allocated memory, a copy constructor, operator= , and destructor must be provided. 17.2 Exercises Draw a diagram of a possible mem- ory layout for a ds set containing the numbers 16, 2, 8, 11, and 5. Is there only one valid memory lay- out for this data as a ds set ? Why? In what order should a forward iter- ator visit the data? Draw an abstract table representa- tion of this data (omits details of TreeNode memory layout).
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
17.3 In-order, Pre-Order, Post-Order Traversal One of the fundamental tree operations is “traversing” the nodes in the tree and doing something at each node.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/21/2012 for the course CSCI 1200 taught by Professor Cutler during the Fall '08 term at Rensselaer Polytechnic Institute.

Page1 / 6

17_trees_II - CSCI-1200 Data Structures - Fall 2010 Lecture...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online