[algogeeks] Re: Algo to find all the possible subsets in a set

2009-08-27 Thread ankur aggarwal
tell us the logic... ankur --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to

[algogeeks] Re: Algo to find all the possible subsets in a set

2009-08-27 Thread Dave
If the set has fewer elements than an integer has bits, just count from 1 to MAXINT. If bit i is 0, the element is not in the set, and if bit i is 1, the element is in the set. Dave On Aug 26, 2:20 pm, AKS abhijeet.k.s...@gmail.com wrote: Hello fellas, i am lookin for an algorithm to find

[algogeeks] Re: Algo to find all the possible subsets in a set

2009-08-27 Thread sandeep jain
Please see http://geeksforgeeks.org/?p=588 Well explained and coded solution. On Thu, Aug 27, 2009 at 5:28 AM, Dave dave_and_da...@juno.com wrote: If the set has fewer elements than an integer has bits, just count from 1 to MAXINT. If bit i is 0, the element is not in the set, and if bit i

[algogeeks] Re: Algo to find all the possible subsets in a set

2009-08-26 Thread Ramaswamy R
The following will generate an output like this - 0 0 1 0 1 2 0 1 2 3 0 1 3 0 2 3 0 3 1 1 2 1 2 3 1 3 2 2 3 3 using these indices you can generate from any given set. class SetGenerator { public: SetGenerator(size_t length) : LENGTH(length) {

[algogeeks] Re: Algo to find all the possible subsets in a set

2009-08-26 Thread Abhijeet Kumar
can i have the algorithm only in plain simple english rather than havin the whole code ??? it ll be really helpful if u tell me the logic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

[algogeeks] Re: Algo to find all the possible subsets in a set

2009-08-26 Thread Ramaswamy R
You just gt generate this pattern of indices into the set - 0 0 1 0 1 2 0 1 2 3 0 1 3 0 2 3 0 3 1 1 2 1 2 3 1 3 2 2 3 3 just figure out the conditions to generate the above yourself ... and you'll figure out what the code does On Wed, Aug 26, 2009 at 10:01 PM, Abhijeet Kumar