组合价值观 [英] Combinate values

查看:102
本文介绍了组合价值观的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要编写一个接受元素列表(1到10之间)的方法,并返回包含所有可能序列的列表。

I need to write a method that accept a list of elements (between 1 and 10) and that returns a list of list that contains all possible sequences.

例如:输入

{ "a", "b", "c" }

输出: 

{ "a" },
{ "b" },
{ "c" },
{ "a", "b" },
{ "a", "c" },
{ "b", "a" },
{ "b", "c" },
{ "c", "a" },
{ "c", "b" },
{ "a", "b", "c" },
{ "a", "c", "b" },
{ "b", "a", "c" },
{ "b", "c", "a" },
{ "c", "a", "b" },
{ "c", "b", "a" },

看似简单,但我找不到怎么做

Seems easy, but I fail to find how to do that

感谢您的帮助

Jojo

推荐答案

这可能有所帮助:  https://www.codeproject.com/Articles/26050/Permutations-Combinations- and-Variations-using-CG

I n general,搜索"c#combinatorics"。或者"组合算法"或"组合算法"。可以帮助你。

In general, searching for "c# combinatorics" or "combinatorics algorithms" may help you along.


这篇关于组合价值观的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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