一组的排列 [英] Permutations of a set

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

问题描述

我有一组X项,但想要长度为Y(X> Y)的排列。我知道< algorithm>中的排列函数,但是我不认为
相信这会做我想要的。有没有办法,或者通过

STL或其他一些库来做这个,还是我需要自己编写

代码?

I have a set of X items, but want permutations of length Y (X > Y). I
am aware of the permutation functions in <algorithm>, but I don''t
believe this will do what I want. Is there a way, either through the
STL or some other library to do this, or do I need to write my own
code?

推荐答案

John Trunek写道:
John Trunek wrote:
我有一组X项,但想要长度为Y(X> Y)的排列。我知道< algorithm>中的排列函数,但我不相信这会做我想要的。有没有办法,无论是通过STL还是其他库来做这件事,还是我需要自己编写代码?
I have a set of X items, but want permutations of length Y (X > Y). I
am aware of the permutation functions in <algorithm>, but I don''t
believe this will do what I want. Is there a way, either through the
STL or some other library to do this, or do I need to write my own
code?




你的术语是非标准的(我不是在谈论C ++

标准)。集合S的置换是从S到S的双射映射。

我的猜测是你想要一组Y-

子集的排列图像(其中S是你的X项集合,其中一个''Y子集''

的S是S的一个子集,它有Y个元素。)


你需要为此编写自己的函数。我认为最简单的方法就是使函数递归,至少在开始时是这样的。

在这里发布你的尝试,我相信你会得到帮助。


-

问候,

巴斯特。



Your terminology is non-standard (and I''m not talking about the C++
standard). A permutation of a set S is a bijective map from S to S.
My guess is that you want the set of images of permutations of Y-
subsets of S (where S is your set of X items, and where a ''Y-subset''
of S is a subset of S which has Y elements).

You need to write your own function for this. It will be easiest
to make the function recursive, at least to begin with, I think.
Post your attempt here and I''m sure you will get help.

--
Regards,
Buster.


John Trunek写道:
John Trunek wrote:
我有一组X项,但想要长度为Y(X> Y)的排列。我知道< algorithm>中的排列函数,但我不相信这会做我想要的。有没有办法,无论是通过STL还是其他库来做这件事,还是我需要自己编写代码?
I have a set of X items, but want permutations of length Y (X > Y). I
am aware of the permutation functions in <algorithm>, but I don''t
believe this will do what I want. Is there a way, either through the
STL or some other library to do this, or do I need to write my own
code?




你的术语是非标准的(我不是在谈论C ++

标准)。集合S的置换是从S到S的双射映射。

我的猜测是你想要一组Y-

子集的排列图像(其中S是你的X项集合,其中一个''Y子集''

的S是S的一个子集,它有Y个元素。)


你需要为此编写自己的函数。我认为最简单的方法就是使函数递归,至少在开始时是这样的。

在这里发布你的尝试,我相信你会得到帮助。


-

问候,

巴斯特。



Your terminology is non-standard (and I''m not talking about the C++
standard). A permutation of a set S is a bijective map from S to S.
My guess is that you want the set of images of permutations of Y-
subsets of S (where S is your set of X items, and where a ''Y-subset''
of S is a subset of S which has Y elements).

You need to write your own function for this. It will be easiest
to make the function recursive, at least to begin with, I think.
Post your attempt here and I''m sure you will get help.

--
Regards,
Buster.


巴斯特写道:
Buster wrote:
John Trunek写道:
John Trunek wrote:
我有一组X项,但想要长度为Y的排列(X> Y) 。我知道< algorithm>中的排列函数,但我不相信这会做我想要的。有没有办法,无论是通过STL还是其他库来做这件事,还是我需要编写自己的代码?
你的术语是非标准的(我是'我不是在谈论C ++
标准。集合S的排列是从S到S的双射映射。
我的猜测是你想要S的Y-
子集的排列图像集(其中S是你的X项集合) ,并且S的''Y子集''是S的子集,其中包含Y元素。)
I have a set of X items, but want permutations of length Y (X > Y). I
am aware of the permutation functions in <algorithm>, but I don''t
believe this will do what I want. Is there a way, either through the
STL or some other library to do this, or do I need to write my own
code?
Your terminology is non-standard (and I''m not talking about the C++
standard). A permutation of a set S is a bijective map from S to S.
My guess is that you want the set of images of permutations of Y-
subsets of S (where S is your set of X items, and where a ''Y-subset''
of S is a subset of S which has Y elements).




s /排列/排列的图像图像/

您需要为此编写自己的功能。我认为最简单的方法就是使函数递归,至少在开始之后。
在这里发布你的尝试,我相信你会得到帮助。



s/images of permutations/permutations of images/
You need to write your own function for this. It will be easiest
to make the function recursive, at least to begin with, I think.
Post your attempt here and I''m sure you will get help.




-

问候,

巴斯特。



--
Regards,
Buster.


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

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