| | | | | |

Defining class BinaryTreeNavigator

template < typename T >
class BinaryTreeNavigator
{
private:
  BinaryTree<T>::Node * currNode_;

public:
  // terminology support
  typedef T                       ValueType;
  typedef BinaryTreeNavigator<T> Navigator;

  // constructors
  BinaryTreeNavigator           ();
  BinaryTreeNavigator           (const BinaryTree<T>& b);
  BinaryTreeNavigator           (const BinaryTreeNavigator& n);
  ~BinaryTreeNavigator  ();

  // structural information
  bool Valid              () const; // Navigator points to valid element
  bool HasParent          () const; // node has valid parent
  bool HasLeftChild       () const; // node has valid left child
  bool HasRightChild      () const; // node has valid right child
  bool IsLeftChild        () const; // node is the left child of its valid parent
  bool IsRightChild       () const; // node is the right child of its valid parent

  // plus operators - syntactically same as bidirectional iterator
  // plus proper type
} ;

| | Top of Page | 14. BST Iterators - 15 of 41