请教一个二叉树的程序
来源:百度知道 编辑:UC知道 时间:2024/06/08 18:40:19
#ifndef BINARYTREE_H
#define BINARYTREE_H
#include <iostream>
#include <vector>
using std::vector;
using std::ostream;
using std::cout;
#define NDEBUG
#ifndef NDEBUG
#define TRACE(os, m) os << m
#else
#define TRACE(os, m)
#endif
template <typename T>
class BinaryTree {
public:
BinaryTree();
BinaryTree(const BinaryTree &tree);
public:
enum PrintType {INORDER, PREORDER, POSTORDER};
typedef typename vector<T>::size_type size_type;
public:
void insert(const T &elem);
T *find(const T &elem) const;
void clear();
void print(ostream &os, PrintType pt) const;
size_type size() const;
BinaryTree &operator=(BinaryTree &tree);
private:
class _Node {
public:
_Node();
_Node(const T &elem);
T _elem;