#include <stdio.h>
#include <math.h>
void PowerSet(char *set, int set_size)
{
unsigned int pow_size = pow(2, set_size);
int count, j;
for(count = 0; count < pow_size; count++)
{
for(j = 0; j < set_size; j++)
{
if(count & (1<<j))
printf("%c", set[j]);
}
printf(",");
}
}
int main()
{
char strset[] = {'a','b','c'};
PowerSet(strset, 3);
return 0;
}
a) O(n)
b) O(1)
c) O(n log n)
d) O(2n) (n is the size of set)
What will be the auxiliary space requirement of the following code?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What will be the auxiliary space requirement of the following code?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!