-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBinaryTree.cs
More file actions
55 lines (42 loc) · 1.18 KB
/
BinaryTree.cs
File metadata and controls
55 lines (42 loc) · 1.18 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Algorithm.Struct
{
public class BinaryTree<T>
{
}
public class BinaryTreeNode<T>
{
public T Value { get; set; }
public BinaryTreeNode<T> Parent { get; set; }
public BinaryTreeNode<T> LeftChild { get; set; }
public BinaryTreeNode<T> RightChild { get; set; }
public bool IsRoot { get; set; }
public bool IsLeaf { get; set; }
public BinaryTreeNode()
{
}
public BinaryTreeNode(T value)
{
this.Value = value;
}
public BinaryTreeNode(T value, BinaryTreeNode<T> parent)
{
this.Value = value;
this.Parent = parent;
}
public BinaryTreeNode(T value, BinaryTreeNode<T> parent, BinaryTreeNode<T> leftChild, BinaryTreeNode<T> rightChild)
{
this.Value = value;
this.Parent = parent;
this.LeftChild = leftChild;
this.RightChild = rightChild;
}
public override string ToString()
{
return this.Value.ToString();
}
}
}