从链接获取子集 [英] Get subsets from link

查看:65
本文介绍了从链接获取子集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能告诉我如何从列表中选择所有子集吗?
这意味着如果我有一个包含值{1,2,3,4}
的列表 我想获取所有这些子列表
{1,2,3,4,12,13,14,23,24,34,123,124,234,1234}
我尝试通过多种方式使其成功,但一次又一次失败.
代码示例可以非常有帮助.
谢谢.

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.

推荐答案

您确定问题正确吗?
我可以看到不在您列表中的组合(仅忽略数字交换):
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

您的列表中不包含"134"-这可能就是为什么您自己无法做到这一点吗?

有很多方法可以做到:请在此处 [ ^ ]和此处 [ ^ ]至少可以使用伪代码进行讨论,或者当然还有不错的旧Google:

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[^]


您正确,
(一个)1、2、3、4
(二)12,13,14,23,24,34
(三)123、124、134、234
(四)1234
谢谢.
You right,
(ones) 1, 2, 3, 4
(twos) 12, 13, 14, 23, 24, 34
(threes) 123, 124, 134, 234
(fours) 1234
Thank you.


这篇关于从链接获取子集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆