Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does anybody can tell me how can I select all sub set from list.
it means that if i have a list that contains values {1,2,3,4}
I want to get all those sub list
{1,2,3,4,12,13,14,23,24,34,123,124,234,1234}
I try to make it in many ways but it fails again and again.
code sample can help very much.
Thanks.
Posted

Are you sure you got the question right?
I can see a combination which is not on your list (ignoring digit swap only):
(ones)   1, 2, 3, 4
(twos)   12, 13, 14, 23, 24, 34
(threes) 123, 124, 134, 234
(fours)  1234
Your list does not contain a "134" - could this be why you are having trouble doing it for yourself?

There are a lot of ways to do it: see here[^] and here[^] for discussions with at the very least pseudo code, or of course there is good old Google: http://www.google.co.uk/search?sourceid=chrome&ie=UTF-8&q=Generate+all+combinations+of+four+characters+c%23[^]
 
Share this answer
 
Comments
Espen Harlinn 10-Apr-11 16:44pm    
Nicely spotted - have a 5
You right,
(ones) 1, 2, 3, 4
(twos) 12, 13, 14, 23, 24, 34
(threes) 123, 124, 134, 234
(fours) 1234
Thank you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900