Number of distinct subsets of a set | CPP program to count number of distinct subsets in an array of distinct numbers ; Returns 2 ^ n ; Driver program to test above function
#include <bits/stdc++.h> NEW_LINE using namespace std ; int subsetCount ( int arr [ ] , int n ) { return 1 << n ; } int main ( ) { int A [ ] = { 1 , 2 , 3 } ; int n = sizeof ( A ) / sizeof ( A [ 0 ] ) ; cout << subsetCount ( A , n ) ; return 0 ; }