binarytree.h

来自「datastucutre and algorithms, application」· C头文件 代码 · 共 29 行

H
29
字号
// abstract class binary tree
// abstract data type specification for binary trees
// all methods are pure virtual functions
// T is node type

#ifndef binaryTree_
#define binaryTree_

#include <functional>

using namespace std;

template<class T>
class binaryTree 
{
   public:
      virtual ~binaryTree() {}
      virtual bool empty() const = 0;
      virtual int size() const = 0;
      virtual void preOrder(void (*) (T *)) = 0;
              // parameter is a pointer to a function whose return
              // type is void and has a single argument of type T*
      virtual void inOrder(void (*) (T *)) = 0;
      virtual void postOrder(void (*) (T *)) = 0;
      virtual void levelOrder(void (*) (T *)) = 0;
};
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?