how to get this type of combinations???

Discussion in 'Perl Misc' started by pradeep, Sep 13, 2011.

  1. pradeep

    pradeep Guest

    Hi,
    I do have a doubt ,
    Input :
    1,2,3,4,5,6
    output :
    1-2,3-4,5-6
    1-2,3-5,4-6
    1-2,3-6,4-5

    1-3,2-4,5-6
    1-3,2-5,4-6
    1-3,2-6,4-5

    1-4,2-3,5-6
    1-4,2-5,3-6
    1-4,2-6,3-5

    1-5,2-3,4-6
    1-5,2-4,3-6
    1-5,2-6,3-4

    1-6,2-3,4-5
    1-6,2-4,3-5
    1-6,2-5,3-4

    Can you help me in this????
    pradeep, Sep 13, 2011
    #1
    1. Advertising

  2. On 13/09/2011 15:06, pradeep wrote:
    > Hi,
    > I do have a doubt ,
    > Input :
    > 1,2,3,4,5,6
    > output :
    > 1-2,3-4,5-6
    > 1-2,3-5,4-6
    > 1-2,3-6,4-5
    >
    > 1-3,2-4,5-6
    > 1-3,2-5,4-6
    > 1-3,2-6,4-5
    >
    > 1-4,2-3,5-6
    > 1-4,2-5,3-6
    > 1-4,2-6,3-5
    >
    > 1-5,2-3,4-6
    > 1-5,2-4,3-6
    > 1-5,2-6,3-4
    >
    > 1-6,2-3,4-5
    > 1-6,2-4,3-5
    > 1-6,2-5,3-4
    >
    > Can you help me in this????


    Yes.

    0) Read posting guidelines that are posted here every few days.

    1) Don't ask homework questions here. Make an attempt first. Read
    http://www.catb.org/~esr/faqs/smart-questions.html#homework - it really
    is useful.

    2) Think of an alogorithm. Implement in concise Perl. Cut & Paste code +
    output here. Describe difference between actual and desired output.

    3) Think of keywords (Combinations? Permutations?). Search CPAN for
    modules. Read descriptions. Write concise Perl to use chosen module. Cut
    & Paste code and output here. Describe difference between actual and
    desired output.

    --
    RGB
    RedGrittyBrick, Sep 13, 2011
    #2
    1. Advertising

  3. pradeep <> wrote:
    >I do have a doubt ,


    You have a doubt about what?

    >Input :
    > 1,2,3,4,5,6


    Well, ok, so I guess this is a list of 5 numbers?

    >output :
    >1-2,3-4,5-6
    >1-2,3-5,4-6
    >1-2,3-6,4-5

    [...]

    Ok, so you are getting this output.

    >Can you help me in this????


    Help you with what? You didn't even ask a question or stated a problem
    yet.
    Not to mention that you forgot to post your code and the desired output.
    Therefore there is no way for us to tell what is wrong with your code.

    jue
    Jürgen Exner, Sep 14, 2011
    #3
  4. >>>>> "Tad" == Tad McClellan <> writes:

    Tad> 4) Do NOT search the internet for the email address of someone
    Tad> who looks like they know Perl and then send them email containing
    Tad> your question!

    Oh, you too?

    Ok, I'm ignoring the loon then.

    [mail deleted]

    --
    Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
    <> <URL:http://www.stonehenge.com/merlyn/>
    Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
    See http://methodsandmessages.posterous.com/ for Smalltalk discussion
    Randal L. Schwartz, Sep 15, 2011
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lily
    Replies:
    16
    Views:
    1,307
    Bob Jenkins
    May 10, 2004
  2. GrantMagic

    Breaking URL character combinations

    GrantMagic, Oct 22, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    410
    bruce barker
    Oct 22, 2004
  3. Thomas Hawtin

    type combinations

    Thomas Hawtin, Apr 29, 2006, in forum: Java
    Replies:
    3
    Views:
    379
    Stefan Ram
    Apr 29, 2006
  4. Stefan Ram

    type combinations

    Stefan Ram, Apr 29, 2006, in forum: Java
    Replies:
    0
    Views:
    284
    Stefan Ram
    Apr 29, 2006
  5. Christoph Blank

    Method to get string combinations

    Christoph Blank, Feb 11, 2009, in forum: Ruby
    Replies:
    8
    Views:
    94
    Giampiero Zanchi
    Feb 12, 2009
Loading...

Share This Page