コード例 #1
0
        public void TestBinarSearch2DSolution()
        {
            int[][] matrix = new int[][]
            {
                new int[4] {
                    1, 3, 5, 7
                },
                new int[4] {
                    10, 11, 16, 20
                },
                new int[4] {
                    23, 30, 34, 50
                },
            };

            // int[][] matrix = new int[][]
            //{
            //     new int[2] { 1,3}
            //};


            var sol    = new BinarSearchSolution();
            var result = sol.SearchMatrix(matrix, 13);

            Assert.AreEqual(result, 1);
        }
コード例 #2
0
        public void TestBinarSearchSolution()
        {
            int[] input  = new int[] { 1, 2 };
            var   sol    = new BinarSearchSolution();
            var   result = sol.FindMin(input);

            Assert.AreEqual(result, 1);
        }