how to get this type of combinations???

P

pradeep

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????
 
R

RedGrittyBrick

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.
 
J

Jürgen Exner

pradeep said:
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
 
R

Randal L. Schwartz

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]
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top