示例#1
0
        public void Search(int key)
        {
            if (_root == null)
            {
                Console.WriteLine("Tree is empty!");
                return;
            }

            BinaryTreeNode targetNode = _root.Search(key);

            if (targetNode == null)
            {
                Console.WriteLine("Search failed");
                return;
            }

            Console.WriteLine("Value found: " + targetNode.GetValue());
        }
示例#2
0
 private void CopyFrom(BinaryTreeNode node)
 {
     SetKey(node.GetKey());
     SetValue(node.GetValue());
 }