Example #1
0
        public static void Sort(double[] arr)
        {
            int length = arr.Length, i;
            TreeAndGraph.BinarySearchTree btn = new TreeAndGraph.BinarySearchTree(arr[0]);

            for (i = 1; i < length; i++)
            {
                btn.AddTreeNode(arr[i]);
            }

            PutArr(btn.root, arr);
        }
Example #2
0
        public static void Sort(double[] arr)
        {
            int length = arr.Length, i;

            TreeAndGraph.BinarySearchTree btn = new TreeAndGraph.BinarySearchTree(arr[0]);

            for (i = 1; i < length; i++)
            {
                btn.AddTreeNode(arr[i]);
            }

            PutArr(btn.root, arr);
        }
Example #3
0
        //Two ACS2 Strings, verify whether every character in one string is included in another string
        public static bool verify(string small, string big)
        {
            if (small.Length == 0 || big.Length == 0)
            {
                return(false);
            }
            char[] big_arr = big.ToCharArray();
            Algorithm.TreeAndGraph.BinarySearchTree dic = new TreeAndGraph.BinarySearchTree(big_arr[0]);
            for (int i = 1; i < big_arr.Length; i++)
            {
                dic.AddTreeNode(big_arr[i]);
            }

            foreach (char c in small.ToCharArray())
            {
                if (!dic.FindTreeNode(c))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #4
0
        //Two ACS2 Strings, verify whether every character in one string is included in another string
        public static bool verify(string small, string big)
        {
            if (small.Length==0 || big.Length ==0)
            {
                return false;
            }
            char[] big_arr  =big.ToCharArray();
            Algorithm.TreeAndGraph.BinarySearchTree dic = new TreeAndGraph.BinarySearchTree(big_arr[0]);
            for (int i = 1; i < big_arr.Length; i++)
            {
                dic.AddTreeNode(big_arr[i]);
            }

            foreach (char c in small.ToCharArray())
            {
                if (!dic.FindTreeNode(c))
                {
                    return false;
                }
            }

            return true;
        }