Пример #1
0
    public static long Capacity(this System.Collections.BitArray bitArray, int sparsity = 100)
    {
        int w = bitArray.Population();
        int n = bitArray.Count;

        return(n ! / (w !*(n - w) !));
    }
Пример #2
0
 /// <summary>
 /// Determines if a bitarray is considered sparse compared to the <paramref name="upperPercentageLimit"/>
 /// </summary>
 /// <param name="bitArray"></param>
 /// <param name="upperPercentageLimit"></param>
 /// <returns></returns>
 public static bool IsSparse(this System.Collections.BitArray bitArray, int upperPercentageLimit)
 => bitArray.Count / 100 * bitArray.Population() < upperPercentageLimit;