コード例 #1
0
        public void SearchTest_TargetLessThanMid_NoRotated()
        {
            var input = new int[] { 4, 5, 6, 7, 0, 1, 2 };

            var solution = new _081_SearchInRotatedSortedArray2();
            var result = solution.Search(input, 5);

            Assert.IsTrue(result);
        }
コード例 #2
0
        public void SearchTest_SmallArray_2()
        {
            var input = new int[] { 1, 3 };

            var solution = new _081_SearchInRotatedSortedArray2();
            var result = solution.Search(input, 3);

            Assert.IsTrue(result);
        }
コード例 #3
0
        public void SearchTest_TargetLargeThanMid_Rotated()
        {
            var input = new int[] { 6, 7, 0, 1, 2, 4, 5 };

            var solution = new _081_SearchInRotatedSortedArray2();
            var result = solution.Search(input, 7);

            Assert.IsTrue(result);
        }
コード例 #4
0
        public void SearchTest_NotFound()
        {
            var input = new int[] { 6, 7, 0, 1, 2, 4, 5 };

            var solution = new _081_SearchInRotatedSortedArray2();
            var result = solution.Search(input, 8);

            Assert.IsFalse(result);
        }
コード例 #5
0
        public void SearchTest_SmallArray_2()
        {
            var input = new int[] { 1, 3 };

            var solution = new _081_SearchInRotatedSortedArray2();
            var result   = solution.Search(input, 3);

            Assert.IsTrue(result);
        }
コード例 #6
0
        public void SearchTest_TargetLessThanMid_Rotated()
        {
            var input = new int[] { 4, 5, 6, 7, 0, 1, 2 };

            var solution = new _081_SearchInRotatedSortedArray2();
            var result   = solution.Search(input, 1);

            Assert.IsTrue(result);
        }
コード例 #7
0
        public void SearchTest_NotFound()
        {
            var input = new int[] { 6, 7, 0, 1, 2, 4, 5 };

            var solution = new _081_SearchInRotatedSortedArray2();
            var result   = solution.Search(input, 8);

            Assert.IsFalse(result);
        }
コード例 #8
0
        public void SearchTest_TargetLargeThanMid_NoRotated()
        {
            var input = new int[] { 6, 7, 0, 1, 2, 4, 5 };

            var solution = new _081_SearchInRotatedSortedArray2();
            var result   = solution.Search(input, 4);

            Assert.IsTrue(result);
        }