Ejemplo n.º 1
0
        public void BinaryTreeSearching_GivenArray_ReturnBool(int[] inputArray, int queryInt, bool result)
        {
            BinaryTreeSearching binaryTreeSearching = new BinaryTreeSearching(inputArray);

            binaryTreeSearching.BuildBinaryTree();
            Assert.Equal(binaryTreeSearching.Search(queryInt), result);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            // test Searching
            //int[] searchArray = new int[] { 4, 8, 3, 6, 0, 13, 29, 17 };
            //BinarySearching binSearch = new BinarySearching(searchArray, 8);
            //bool result = binSearch.BinarySearch();
            //Console.WriteLine(result);

            //int[] searchArray = new int[] { 4, 8, 3, 6, 0, 13, 29, 17 };
            //int[] searchArray = new int[] { 4, 8, 3, 6, 0, 13, 8,29, 17 };
            int[] searchArray = new int[] { 4 };

            BinaryTreeSearching binaryTreeSearching = new BinaryTreeSearching(searchArray);

            binaryTreeSearching.BuildBinaryTree();
            Console.WriteLine(binaryTreeSearching.Search(10));
            Console.WriteLine(binaryTreeSearching.Search(6));
            binaryTreeSearching.ShowBinaryTree();
        }