Binary Search Tree
// Binary search tree node
Public class BinarySearchTreeNode
{Public int key; // The value of the binary query Tree node.
Public BinarySearchTreeNode left; // left subnode of the Binary Search Tree node
Public BinarySearchTreeNode right; // right subnode of the Binary Search Tree node
/// Binary Search Tree node Constructor
Public BinarySearchTreeNode (int nodeValue)
{Key = nodeValue; // nodeValue node Value
Left = null; right = null;
}
/// Insert a node
Public void InsertNode (BinarySearchTreeNode node)
{If (node. key> this. key)
{If (this. right = null)
{This. right = node; // node to be inserted
Return;
}
Else
This. right. InsertNode (node );
}
Else
{If (this. left = null)
{This. left = node; return ;}
Else
This. left. InsertNode (node );
}
}
/// Binary Search Tree Query
Public bool SearchKey (int searchValue)
{If (this. key = searchValue) // the value to be queried by searchValue
Return true; // whether the queried value is found
If (searchValue> this. key)
{If (this. right =