2 Replies Latest reply: Jul 30, 2010 12:54 AM by 843853 RSS

    Set Partitions

    843853
      Hi there,

      I'm looking to understand the partitioning implementation in Java. I'm going to use this in one of my modules for a robotics project.

      Let's say I have an array of Strings
      String[] elements = {"A","B","C"};
      The partitions of the elements would look like..

      A, B, C
      A, BC
      AB, C
      AC, B
      ABC

      How can I possibly break down the problem and find a clean, exact way to implement this using Java?

      Thanks
        • 1. Re: Set Partitions
          796262
          hussain wrote:
          How can I possibly break down the problem and find a clean, exact way to implement this using Java?
          If you're looking for a solution "out of the box", I doubt you'll find one. That means you're going to have to implement it yourself.

          Like any algorithm, the first step is to write out the process without any regard to a programming language. If you can hand your instructions separately to an old lady and a little kid and have them each follow them and arrive at the correct output, you might be ready to translate your steps into code.
          • 2. Re: Set Partitions
            843853
            hmm... thanks for that .. now, I have some food for thought to start with