示例#1
0
        static void Main(string[] args)
        {
            BST bst = new BST();

            bst.Add(56);
            bst.Add(30);
            bst.Add(70);
            bst.Add(99);
            bst.Add(20);
            Console.WriteLine(bst.Size());
            Console.WriteLine(bst.Search(bst.root, 999));
        }
示例#2
0
        static void Main(string[] args)
        {
            BST binarySearchTree = new BST();

            binarySearchTree.Insert(56);
            binarySearchTree.Insert(30);
            binarySearchTree.Insert(70);
            binarySearchTree.Insert(22);
            binarySearchTree.Insert(40);
            binarySearchTree.Insert(11);
            binarySearchTree.Insert(3);
            binarySearchTree.Insert(16);
            binarySearchTree.Insert(60);
            binarySearchTree.Insert(95);
            binarySearchTree.Insert(65);
            binarySearchTree.Insert(63);
            binarySearchTree.Insert(67);
            binarySearchTree.Display();
            Console.WriteLine("size of binary search tree is : " + binarySearchTree.Size());
            Console.WriteLine("element " + binarySearchTree.Search(63) + " found in binary search tree");
        }