tree.h
来自「数据结构与程序设计教材源码 数据结构与程序设计教材源码」· C头文件 代码 · 共 43 行
H
43 行
template <class Entry>
class Binary_tree {
public:
// Add methods here.
Binary_tree();
bool empty() const;
void preorder(void (*visit)(Entry &));
void inorder(void (*visit)(Entry &));
void postorder(void (*visit)(Entry &));
int size() const;
void clear();
int height() const;
void insert(const Entry &);
Binary_tree (const Binary_tree<Entry> &original);
Binary_tree & operator =(const Binary_tree<Entry> &original);
~Binary_tree();
// tree testing commands
Error_code remove(Entry &);
void prenode(void (*f)(Binary_node<Entry> *&));
void swap();
void recursive_inorder(Binary_node<Entry> *, void (*visit)(Entry &));
void recursive_preorder(Binary_node<Entry> *, void (*visit)(Entry &));
void recursive_postorder(Binary_node<Entry> *, void (*visit)(Entry &));
void recursive_insert(Binary_node<Entry> *&sub_root, const Entry &x);
int recursive_size(Binary_node<Entry> *sub_root) const;
int recursive_height(Binary_node<Entry> *sub_root) const;
void recursive_clear(Binary_node<Entry> *&sub_root);
Binary_node<Entry> *recursive_copy(Binary_node<Entry> *sub_root);
void recursive_swap(Binary_node<Entry> *sub_root);
Binary_node<Entry> *&find_node(Binary_node<Entry> *&, const Entry &) const;
Error_code remove_root(Binary_node<Entry> *&sub_root);
protected:
// Add auxiliary function prototypes here.
Binary_node<Entry> *root;
};
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?