Beispiel #1
0
        static void Main(string[] args)
        {
            //1
            string[] names1 = new string[] { "Ava", "Emma", "Olivia" };
            string[] names2 = new string[] { "Olivia", "Sophia", "Emma" };
            Console.WriteLine(string.Join(", ", MergeNames.UniqueNames(names1, names2)));

            //2
            Node n1 = new Node(1, null, null);
            Node n3 = new Node(3, null, null);
            Node n2 = new Node(2, n1, n3);

            Console.WriteLine(BinarySearchTree.Contains(n2, 3));

            //3
            TextInput input = new NumericInput();

            input.Add('1');
            input.Add('a');
            input.Add('0');
            Console.WriteLine(input.GetValue());

            //4
            Console.WriteLine(SortedSearch.CountNumbers(new int[] { 1, 3, 5, 7 }, 4));

            //6
            Account account = new Account(-20);

            account.Deposit(20);
            account.Withdraw(10);

            //7
            Tuple <int, int> indices = TwoSum.FindTwoSum(new List <int>()
            {
                3, 1, 5, 7, 5, 9
            }, 10);

            if (indices != null)
            {
                Console.WriteLine(indices.Item1 + " " + indices.Item2);
            }
        }
 public static void Main(string[] args)
 {
     int[] sortedArray = new int[] { 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25 };
     Console.WriteLine(SortedSearch.CountNumbersRecursive(sortedArray, 7, 0, sortedArray.Length - 1, (sortedArray.Length - 1) / 2));
 }