How can I maximally partition a set?
        Posted  
        
            by Gregory Higley
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Gregory Higley
        
        
        
        Published on 2009-10-24T18:25:47Z
        Indexed on 
            2010/05/01
            0:17 UTC
        
        
        Read the original article
        Hit count: 292
        
I'm trying to solve one of the Project Euler problems. As a consequence, I need an algorithm that will help me find all possible partitions of a set, in any order.
For instance, given the set 2 3 3 5:
2 | 3 3 5
2 | 3 | 3 5
2 | 3 3 | 5
2 | 3 | 3 | 5
2 5 | 3 3
and so on. Pretty much every possible combination of the members of the set. I've searched the net of course, but haven't found much that's directly useful to me, since I speak programmer-ese not advanced-math-ese.
Can anyone help me out with this? I can read pretty much any programming language, from BASIC to Haskell, so post in whatever language you wish.
© Stack Overflow or respective owner