-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHuffmanTreeNode.h
52 lines (45 loc) · 1.16 KB
/
HuffmanTreeNode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef HUFFMAN_TREE_NODE_H
#define HUFFMAN_TREE_NODE_H
#include<iostream>
using namespace std;
// 哈夫曼树的结点
template<class T>
class HuffmanTreeNode
{
public:
int weight;
T data; //代表符号
HuffmanTreeNode<T>* left;
HuffmanTreeNode<T>* right;
HuffmanTreeNode<T>* parent;
HuffmanTreeNode(T data,int weight)
{
this->weight = weight;
this->data = data;
right = NULL;
left = NULL;
parent = NULL;
}
bool operator<(HuffmanTreeNode<T>* node1) const
{
cout<<"----"<<endl;
if(this->weight < node1->weight)
return true;
return false;
}
bool operator>(HuffmanTreeNode<T>* node1) const
{
cout<<"----"<<endl;
if(this->weight > node1->weight)
return true;
return false;
}
bool operator==(HuffmanTreeNode<T>* node1) const
{
cout<<"----"<<endl;
if(this->weight == node1->weight)
return true;
return false;
}
};
#endif