public int CountMethod_CreateTreeAndGetCountElements(int[] array) { Tree.BinaryTree <int> binaryTree = new Tree.BinaryTree <int>(); foreach (var element in array) { binaryTree.Add(element); } return(binaryTree.Count); }
public bool ContainsMethod_CreateTreeAndCheckForContainsElement(int[] array, int value) { Tree.BinaryTree <int> binaryTree = new Tree.BinaryTree <int>(); foreach (var element in array) { binaryTree.Add(element); } return(binaryTree.Conatins(value)); }
public int[] InoredBypassMethod_CreateTreeAndGetItInoredBypass(int[] array) { Tree.BinaryTree <int> binaryTree = new Tree.BinaryTree <int>(); foreach (var element in array) { binaryTree.Add(element); } int[] result = new int[array.Length]; int i = 0; foreach (var value in binaryTree.InorderBypass()) { result[i++] = value; } return(result); }
public int[] GetEnumeratorMethods_CreateTreeAndGetItEnumerator(int[] array) { Tree.BinaryTree <int> binaryTree = new Tree.BinaryTree <int>(); foreach (var element in array) { binaryTree.Add(element); } int[] result = new int[array.Length]; int i = 0; foreach (var value in binaryTree) { result[i++] = value; } return(result); }
public void InoredBypassMethod_CreateTreeWithStringAndGetItInoredBypass() { string[] elements = new string[] { "fffff", "kkkkkkkkk", "aaaa", "c" }; string[] expectedResult = new string[] { "c", "aaaa", "fffff", "kkkkkkkkk" }; Tree.BinaryTree <string> binaryTree = new Tree.BinaryTree <string>((left, right) => left.Length.CompareTo(right.Length)); foreach (var element in elements) { binaryTree.Add(element); } string[] result = new string[elements.Length]; int i = 0; foreach (var value in binaryTree.InorderBypass()) { result[i++] = value; } Assert.AreEqual(expectedResult, result); }