public static string TreePreorderBypass_NewCompareInt_Test(int[] array) { string s = ""; Tree<int> tree = new Tree<int>(new CompareInt()); foreach (int a in array) tree.AddNode(a); foreach (int a in tree.PreorderIterator()) s += a; Debug.WriteLine(s); return s; }
public void TreePreorderBypass_NewCompareString_Test() { string s = ""; string[] array = new string[] { "500", "40", "5", "37", "1000", "10000" }; Tree<string> tree = new Tree<string>(new CompareString()); foreach (var a in array) tree.AddNode(a); foreach (var a in tree.PreorderIterator()) s += a; Assert.AreEqual(s, "50040537100010000"); }