Exemplo n.º 1
0
        public static void AddRandomNumbers(BinarySearchTree bst, int minVal, int maxVal, int n)
        {
            int[] a = Utils.GenerateRandomDistinctArray(minVal, maxVal, n);
            //int[] a = new int[] {  41, 16, 76, 66, 20, 83, 12, 38, 86, 97, 53, 55, 60, 92, 1, 25, 31, 74, 45, 5 };
            Utils.PrintArray(a, "Input distinct arr: ");

            if (a != null)
            {
                foreach (int val in a)
                {
                    bst.Insert(val);
                }
            }

            bst.PrintInOrderRecursive();
            bst.PrintInOrderNonRecursive();
        }