powerSetCardinality<T> static method

int powerSetCardinality<T>(
  1. CustomSet<T> set
)

Calculates the cardinality of the power set of a set.

Formula: |P(A)| = 2^|A|

The power set contains all possible subsets of the given set.

Example:

final a = CustomSet<int>([1, 2, 3]);
print(CardinalityUtils.powerSetCardinality(a)); // Output: 8

Implementation

static int powerSetCardinality<T>(CustomSet<T> set) =>
    1 << set.cardinality;