static void Main(string[] args) { int[] datas = { 23, 45, 16, 37, 3, 99, 22 }; var bst = new BST(); //foreach (var data in datas) //{ // bst.BuildBST(data); //} //var bstRoot = bst.Root; var bstRoot = bst.BuildBST(datas); Console.WriteLine("中序遍历:"); bst.InOrder(bstRoot); Console.WriteLine("\r\n先序遍历:"); bst.PreOrder(bstRoot); Console.WriteLine("\r\n后序遍历:"); bst.PostOrder(bstRoot); Console.WriteLine("\r\n最小值:"); Console.Write(bst.FindMin()); Console.WriteLine("\r\n最小值节点:"); Console.Write(bst.FindMinNode()); Console.WriteLine("\r\n最大值:"); Console.Write(bst.FindMax()); Console.WriteLine("\r\n最大值节点:"); Console.Write(bst.FindMaxNode()); Console.WriteLine("\r\n查找指定值:"); Console.Write(bst.FindNode(45)); Console.ReadLine(); }