예제 #1
0
        public static void BinarySearch()
        {
            var obj = new CareerCupQnA();

            Console.WriteLine(obj.BinarySearch(new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            }, 0, 10, 3));
            Console.WriteLine("*************************************************************");
            Console.WriteLine(obj.BinarySearch(new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            }, 0, 10, 7));
            Console.WriteLine("*************************************************************");
            Console.WriteLine(obj.BinarySearch(new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            }, 0, 10, 5));
            Console.WriteLine("*************************************************************");
            Console.WriteLine(obj.BinarySearch(new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            }, 0, 10, 1));
            Console.WriteLine("*************************************************************");
            Console.WriteLine(obj.BinarySearch(new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            }, 0, 10, 10));
        }