DataSharp/Mathematics/FunctionalityTest.cs
/// <summary>
/// This method tries to extract all (k-1)-subsets from the set with k elements.
/// </summary>
This method tries to extract all (k-1)-subsets from the set with k elements.
This method tries to extract all ( k - 1 ) - subsets from the set with k elements .
public static void GetSubsetsDemo()
        {
            int[] values = { 1, 2, 3, 4, 5, 6, 7 };
            SortedSet<int> set = new SortedSet<int>(values);
            int numSelection = 6;
            var subsets = SetHelper.GetSubsets(set, numSelection);
            Console.Write("The original set is: ");
            PrintIEnumerable(set);
            foreach (ISet<int> s in subsets)
            {
                foreach (int i in s)
                    Console.Write(i + " ");
                Console.WriteLine("is the subset of the original set : {0}, and its type is SortedSet<int> : {1}", s.IsProperSubsetOf(set), s is SortedSet<int>);
            }
        }
public static void GetSubsetsDemo ( ) { int [ ] values = { 1 , 2 , 3 , 4 , 5 , 6 , 7 } ; SortedSet < int > set = new SortedSet < int > ( values ) ; int numSelection = 6 ; var subsets = SetHelper . GetSubsets ( set , numSelection ) ; Console . Write ( " " ) ; PrintIEnumerable ( set ) ; foreach ( ISet < int > s in subsets ) { foreach ( int i in s ) Console . Write ( i + " " ) ; Console . WriteLine ( " " , s . IsProperSubsetOf ( set ) , s is SortedSet < int > ) ; } }
This method tries to extract all (k-1)-subsets from the set with k elements.
This method tries to extract all ( k - 1 ) - subsets from the set with k elements .
// Initialize a set with 7 elements for testing. // Generate all the subsets of the set we initialize above with 6 elements. // Print the original set so that the developer can check it. // Print all the subsets, one in each line.