static void Main(string[] args) { // TESTING search tree Insertion // 2643 adds Console.WriteLine(" Ternary Search Tree Add "); Stopwatch myStopWatch = new Stopwatch(); myData data = new myData(); TST <int> myTry = new TST <int>(); myStopWatch.Start(); for (int i = 0; i < 3; i++) { myTry.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("3 Insertions: " + myStopWatch.Elapsed); // 1000 adds myStopWatch = new Stopwatch(); data = new myData(); myTry = new TST <int>(); myStopWatch.Start(); for (int i = 0; i < 9; i++) { myTry.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("9 Insertions: " + myStopWatch.Elapsed); // 100 adds myStopWatch = new Stopwatch(); data = new myData(); myTry = new TST <int>(); myStopWatch.Start(); for (int i = 0; i < 27; i++) { myTry.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("27 Insertions: " + myStopWatch.Elapsed); myStopWatch = new Stopwatch(); data = new myData(); myTry = new TST <int>(); myStopWatch.Start(); for (int i = 0; i < 81; i++) { myTry.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("81 Insertions: " + myStopWatch.Elapsed); // 100 adds myStopWatch = new Stopwatch(); data = new myData(); myTry = new TST <int>(); myStopWatch.Start(); for (int i = 0; i < 243; i++) { myTry.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("243 Insertions: " + myStopWatch.Elapsed); // 10 adds myStopWatch = new Stopwatch(); data = new myData(); myTry = new TST <int>(); myStopWatch.Start(); for (int i = 0; i < 729; i++) { myTry.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("729 Insertions: " + myStopWatch.Elapsed); // Testing Dictionary search tree Insertions // 977 adds Console.WriteLine(" Testing the Dictionary"); myStopWatch = new Stopwatch(); data = new myData(); Dictionary <string, int> myDictionary = new Dictionary <string, int>(); myStopWatch.Start(); for (int i = 0; i < 3; i++) { myDictionary.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("3 Insertions: " + myStopWatch.Elapsed); myStopWatch = new Stopwatch(); data = new myData(); myDictionary = new Dictionary <string, int>(); myStopWatch.Start(); for (int i = 0; i < 27; i++) { myDictionary.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("27 Insertions: " + myStopWatch.Elapsed); myStopWatch = new Stopwatch(); data = new myData(); myDictionary = new Dictionary <string, int>(); myStopWatch.Start(); for (int i = 0; i < 81; i++) { myDictionary.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("81 Insertions: " + myStopWatch.Elapsed); myStopWatch = new Stopwatch(); data = new myData(); myDictionary = new Dictionary <string, int>(); myStopWatch.Start(); for (int i = 0; i < 243; i++) { myDictionary.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("243 Insertions: " + myStopWatch.Elapsed); myStopWatch = new Stopwatch(); data = new myData(); myDictionary = new Dictionary <string, int>(); myStopWatch.Start(); for (int i = 0; i < 729; i++) { myDictionary.Add(data.words[i], i); } myStopWatch.Stop(); Console.WriteLine("729 Insertions: " + myStopWatch.Elapsed); // TESTING // Contains// Partial Match // Autocomplete Console.WriteLine(" Ternary Search Tree Add "); data = new myData(); myTry = new TST <int>(); myStopWatch.Start(); for (int i = 0; i < 1000; i++) { myTry.Add(data.words[i], i); } Boolean value = myTry.Contains("chaos"); List <string> list = myTry.Autocomplete("ch"); List <string> list2 = myTry.PartialMatch("ch***"); List <string> list3 = myTry.PartialMatch("***b**"); Console.WriteLine("List: AutoComplete ch "); foreach (string element in list) { Console.Write(element + " "); } Console.WriteLine(); Console.WriteLine("List2: PartialMatch ch*** "); foreach (string element in list2) { Console.Write(element + " "); } Console.WriteLine(); Console.WriteLine("List3: PartialMatch ***b** "); foreach (string element in list3) { Console.Write(element + " "); } Console.ReadLine(); }