/// <summary> /// Main entrance of program. /// This program will take in a user input and create a BST /// with that input. NO DUPLICATES WOULD BE ACCEPTED. /// Will display stats of the BST after calculations are performed. /// </summary> /// <param name="args">Args.</param> public static void Main(string[] args) { // Gets users input of integers in a string. string userInput = GetInput(); // Converts string input into an array if integers and inserts these number into a BST. int[] arr = ConvertInput(userInput); BST bst = new BST(); foreach (var number in arr) { bst.Insert(number); } // Calculates stats of BST and displays the stats. int levels = bst.GetLevels(); int itemCount = bst.GetItemCount(); int minLevelsReq = bst.GetMinLevels(); // Displays BST in order. Console.WriteLine("{0}", bst.DisplayInSortedOrder()); Console.WriteLine("Levels: {0} \nItemCount: {1} \nMinLevelsRequired: {2}", levels, itemCount, minLevelsReq); }
public void MakeTree() { BST bst = new BST(); Assert.AreEqual(null, bst.Root); }