Isn't this a normal power set generation problem. What we are trying to do here is, get all possible subsets. you can look for it on Google/Live
-Vijju Visit me at http://vijju.net/ On 2/2/07, Gene <[EMAIL PROTECTED]> wrote: > > > > > On Feb 2, 5:02 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > Hey, > > > > I am looking for an algorithm to do as follows: > > > > my @array = qw (A B C); # This array may have several parameters, > > for > > ex. A B C D > > > > I will like to generate following (not sure if this will be called > > permutation): > > > > <NULL> > > C > > B > > A > > B C > > A C > > A B > > A B C > > > > Available permutation algorithms generate a different output, for > > example: > > b c a > > c b a > > c a b > > a c b > > b a c > > a b c > > > > Any suggestions! Thanks in advance. > > This is called the power set. You can easily generate the power set > by identifying each of the original elements with a digit in a binary > number and then counting. The 1's in the successive counts tell you > whether to include the element in the current output or not. > > Identify binary digits cba with C B A: > > 000 = {} > 001 = A > 010 = B > 011 = BA > 100 = C > 101 = CA > 110 = CB > 111 = CBA > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups-beta.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---