Ejemplo n.º 1
0
        public void TestSecondCase()
        {
            int[] array  = new int[] { };
            var   sol    = new SortedArrayToBst(array);
            var   result = sol.CreateBSTFromSortedArray();

            Assert.Null(result);
        }
Ejemplo n.º 2
0
        public void TestThirdCase()
        {
            int[] array  = new int[] { -10, -3, 0, 5, 9 };
            var   sol    = new SortedArrayToBst(array);
            var   result = sol.CreateBSTFromSortedArray();

            Assert.IsNotNull(result);
        }
Ejemplo n.º 3
0
        public TreeNode SortedArrayToBST(int[] nums)
        {
            var sol = new SortedArrayToBst(nums);

            return(sol.CreateBSTFromSortedArray());
        }