-
Notifications
You must be signed in to change notification settings - Fork 0
/
AVL.h
77 lines (61 loc) · 1.2 KB
/
AVL.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef AVL_H_INCLUDED
#define AVL_H_INCLUDED
template <class K,class I>
class Node
{
K key;
I info;
Node* right;
Node* left;
int height;
public:
Node(Node* newRight, Node* newLeft,K newKey, I newInfo, int newHeight = 1)
{
right = newRight;
left = newLeft;
key = newKey;
info = newInfo;
height = newHeight;
}
I Get_Info()
{
return info;
}
K Get_Key()
{
return key;
}
Node* Get_Left()
{
return left;
}
Node* Get_Right()
{
return right;
}
int Get_Height()
{
return height;
}
void Set_Info(I newInfo)
{
info = newInfo;
}
void Set_Left(Node* newLeft)
{
left = newLeft;
}
void Set_Right(Node* newRight)
{
right = newRight;
}
void Set_Height(int newHeight)
{
height = newHeight;
}
void Set_Key(K newKey)
{
key = newKey;
}
};
#endif // AVL_H_INCLUDED