Exemplo n.º 1
0
        public void SearchTest_SmallArray_2()
        {
            var input = new int[] { 1, 3 };

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

            Assert.AreEqual(1, result);
        }
Exemplo n.º 2
0
        public void SearchTest_NotFound()
        {
            var input = new int[] { 6, 7, 0, 1, 2, 4, 5 };

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

            Assert.AreEqual(-1, result);
        }
Exemplo n.º 3
0
        public void SearchTest_TargetLessThanMid_Rotated()
        {
            var input = new int[] { 4, 5, 6, 7, 0, 1, 2 };

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

            Assert.AreEqual(5, result);
        }
Exemplo n.º 4
0
        public void SearchTest_TargetLessThanMid_Rotated_2()
        {
            var input = new int[] { 7, 8, 0, 1, 2, 4, 5, 6 };

            var solution = new _033_SearchInRotatedSortedArray();
            var result   = solution.Search(input, 0);

            Assert.AreEqual(2, result);
        }
        public void SearchTest_TargetLessThanMid_NoRotated()
        {
            var input = new int[] { 4, 5, 6, 7, 0, 1, 2 };

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

            Assert.AreEqual(1, result);
        }
        public void SearchTest_TargetLargeThanMid_Rotated_2()
        {
            var input = new int[] { 4, 5, 6, 7, 8, 0, 1, 2 };

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

            Assert.AreEqual(4, result);
        }
        public void SearchTest_SmallArray_2()
        {
            var input = new int[] { 1,3 };

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

            Assert.AreEqual(1, result);
        }
        public void SearchTest_NotFound()
        {
            var input = new int[] { 6, 7, 0, 1, 2, 4, 5 };

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

            Assert.AreEqual(-1, result);
        }