-
Notifications
You must be signed in to change notification settings - Fork 0
/
AvlNode.h
60 lines (45 loc) · 1002 Bytes
/
AvlNode.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
53
54
55
56
57
58
59
60
/*
* AvlNode.h
*
* Created on: Nov 8, 2012
* Author: tyler
*/
#ifndef AVLNODE_H_
#define AVLNODE_H_
template <typename Key, typename E>
class AvlTree;
template<typename Key, typename E> class AvlNode {
friend class AvlTree<Key,E>;
public:
AvlNode(Key k, E data, AvlNode<Key, E> * lst, AvlNode<Key, E> * rst, int h = 0) {
key_ = k;
val = data;
left = lst;
right = rst;
height = h;
}
int getHeight() {
return height;
}
void setHeight(int h) {
height = h;
}
E getVal() {
return val;
}
Key getKey() {
return key_;
}
//AvlNode<E> * getLeft() {return left;}
//AvlNode<E> * getRight() {return right;}
//void setLeft(AvlNode<E> * lst) {left = lst;}
//void setRight(AvlNode<E> * rst) {right = rst;}
//virtual ~AvlNode();
private:
Key key_;
E val;
AvlNode<Key, E> * left;
AvlNode<Key, E> * right;
int height;
};
#endif /* AVLNODE_H_ */