



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Class: DATA STRUCTURES; Subject: Computer Science; University: Rensselaer Polytechnic Institute; Term: Spring 2006;
Typology: Assignments
1 / 6
This page cannot be seen from the preview
Don't miss anything!




77
ant zebra
cat
dog
goat
horse
lion
mouse
mule
tiger
Consider the following values:
4.5, 9.8, 3.5, 13.6, 19.2, 7.4, 11.
// Partial implementation of binary-tree based set class similar to std::set. // The iterator increment & decrement operations have been omitted. #ifndef cs2set_h_ #define cs2set_h_ #include
// ------------------------------------------------------------------- // TREE NODE CLASS template
template
// ------------------------------------------------------------------- // TREE NODE ITERATOR CLASS template
// operator* gives constant access to the value at the pointer const T& operator*() const { return ptr_->value; } // comparions operators are straightforward friend bool operator==(const tree_iterator& l, const tree_iterator& r) { return l.ptr_ == r.ptr_; } friend bool operator!=(const tree_iterator& l, const tree_iterator& r) { return l.ptr_ != r.ptr_; }
private: // representation TreeNode
// ------------------------------------------------------------------- // CS2 SET CLASS template
typedef tree_iterator
int size() const { return size_; } bool operator==(const cs2set