树
0.1
数据结构_第6章
Tree.h
Go to the documentation of this file.
1
/****************************************************
2
* @file Tree.h
3
* @author Guorui Wei (313017602@qq.com)
4
* @brief 树的抽象类
5
* @version 0.1
6
* @date 2020-04-19
7
*
8
* @copyright Copyright (c) 2020
9
*
10
* See the file LICENSE in the top directory of this distribution for
11
* more information.
12
*
13
****************************************************/
14
15
#ifndef INCLUDE_TREE_H_
16
#define INCLUDE_TREE_H_
17
18
#include "
TreeException.hh
"
19
#include <cstddef>
20
25
namespace
Tree
26
{
27
template
<
typename
T>
28
class
Tree
29
{
30
public
:
35
typedef
T value_type;
36
typedef
value_type &reference;
37
typedef
const
value_type &const_reference;
38
typedef
size_t
size_type;
39
40
public
:
41
virtual
void
clear() = 0;
42
virtual
bool
isEmpty()
const
= 0;
43
virtual
value_type
root(
value_type
flag)
const
= 0;
44
virtual
value_type
parent(
value_type
x,
value_type
flag)
const
= 0;
45
virtual
value_type
child(
value_type
x,
size_type
i,
value_type
flag)
const
= 0;
46
virtual
void
remove(
value_type
x,
size_type
i) = 0;
47
virtual
void
traverse()
const
= 0;
48
};
49
50
}
// namespace Tree
51
52
#include "
binTree.h
"
53
#include "
binaryTree.hh
"
54
55
#endif
/* INCLUDE_TREE_H_ */
binTree.h
Tree::Tree::value_type
T value_type
类型别名定义
Definition:
Tree.h:59
Tree
自定义的树类都在Tree名字空间内
Definition:
binaryTree.hh:27
Tree::Tree::size_type
size_t size_type
计数器类型
Definition:
Tree.h:62
binaryTree.hh
TreeException.hh
include
Tree.h
Generated on Mon Jul 6 2020 21:04:45 for 树 by
1.8.17