-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathAVLTreeNode.cs
45 lines (40 loc) · 1.26 KB
/
AVLTreeNode.cs
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
namespace DataStructures.Trees
{
/// <summary>
/// AVL Tree Node.
/// </summary>
public class AVLTreeNode<T> : BSTNode<T> where T : System.IComparable<T>
{
private int _height = 0;
public AVLTreeNode() : this(default(T), 0, null, null, null) { }
public AVLTreeNode(T value) : this(value, 0, null, null, null) { }
public AVLTreeNode(T value, int height, AVLTreeNode<T> parent, AVLTreeNode<T> left, AVLTreeNode<T> right)
{
base.Value = value;
Height = height;
Parent = parent;
LeftChild = left;
RightChild = right;
}
public virtual int Height
{
get { return this._height; }
set { this._height = value; }
}
public new AVLTreeNode<T> Parent
{
get { return (AVLTreeNode<T>)base.Parent; }
set { base.Parent = value; }
}
public new AVLTreeNode<T> LeftChild
{
get { return (AVLTreeNode<T>)base.LeftChild; }
set { base.LeftChild = value; }
}
public new AVLTreeNode<T> RightChild
{
get { return (AVLTreeNode<T>)base.RightChild; }
set { base.RightChild = value; }
}
}
}