public void Add int value ref Node head if head null head new Node val

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
public void Add( int value, ref Node head)
{
if (head == null)
{
head = new Node(value, null, null);
}
else
{
if (head.value < value)
{
Add(value, ref head.right);
}
else
{
Add(value, ref head.left);
}
}
}