我如何获得所有可能的匹配 [英] How do I get all possible matches

查看:83
本文介绍了我如何获得所有可能的匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个控制台项目,我有一系列字符,如'a','b','c','d'等。我想要打印所有可能发生的匹配这些字符比如b'ab',a表示c'ac',b表示c'bc',a表示b表示c'abc',依此类推。我怎么能实现那个?一个示例代码将是伟大的!谢谢

Hi, I'm making a console project and I have an array of characters like 'a', 'b', 'c', 'd' etc.. and I want to print all possible matches that can happen between the chars like a with b 'ab', a with c 'ac', b with c 'bc', a with b with c 'abc' and so on. How can i achieve that?? An example code would be great!!!! Thanks

推荐答案

我建​​议你阅读:使用C#泛型的排列,组合和变体 [ ^ ]



这个:非递归排列和组合 [ ^ ]



或搜索类似文章的CP ,有很多: http://www.codeproject.com/search.aspx?q=permutations& ; sbo = kw [ ^ ]
I'd suggest to read this: Permutations, Combinations, and Variations using C# Generics[^]

And this: Non-recursive Permutations and Combinations[^]

Or search CP for similar articles, there are many: http://www.codeproject.com/search.aspx?q=permutations&sbo=kw[^]


这篇关于我如何获得所有可能的匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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