数组的子集 [英] subsets of array

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

问题描述

我有一个n个整数数组,我想要一个返回所有可能子集的

数组列表的函数。有人可以给我提供代码吗?


谢谢。

Jess

解决方案

< blockquote> * Jessica Weiner:

我有一个n个整数的数组,我想要一个返回所有可能子集的
数组列表的函数。


n中可能的子集数量呈指数:你认为需要多少内存?b / b $

因为这显然是家庭作业(请在发布之前查看这个小组的常见问题解答,

)我会留给你确切知道公式是什么。


它可能也在您的教科书中说明。


有人可以提供代码吗?




是的,但是/会/有人为你做家庭作业吗?


希望不是。


见常见问题解答关于发布家庭作业问题的项目。


-

答:因为它弄乱了人们通常阅读文本的顺序。

问:为什么这么糟糕?

A:热门发布。

问:usenet和电子邮件中最烦人的是什么?


Alf P. Steinbach写道:

因为这显然是HOMEWORK(见这个发布之前小组的常见问题解答,
请)我会留给你确切知道公式
是什么。




它不是功课,你笨蛋。如果你无法帮助别人,那么只需保持闭嘴,因为它只会显示你是多么愚蠢。


Jessica Weiner写道:

它不是功课,你笨蛋。如果你无法帮助别人,那么只需要闭嘴,因为它只是表明你是多么愚蠢。




哇,非常快速进入old killfile。

* plonk *


Brian


I have an array of n integers and I want a function that returns a list of
arrays of all possible subsets. Can someone provide me with the code?

Thanks.
Jess

解决方案

* Jessica Weiner:

I have an array of n integers and I want a function that returns a list of
arrays of all possible subsets.
The number of possible subsets is exponential in n: how much memory do
you think that will require?

Since this is obviously HOMEWORK (see this group''s FAQ before posting,
please) I''ll leave it to you to figure out exactly what the formula is.

It''s probably also stated in your textbook.

Can someone provide me with the code?



Yes, but /will/ someone do your HOMEWORK for you?

Hopefully not.

See the FAQ''s item about posting HOMEWORK questions.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


Alf P. Steinbach wrote:

Since this is obviously HOMEWORK (see this group''s FAQ before posting,
please) I''ll leave it to you to figure out exactly what the formula
is.



Its not homework, you dumbass. If you cannot help someone then simply keep
your mouth shut because it only goes to show how stupid you are.


Jessica Weiner wrote:

Its not homework, you dumbass. If you cannot help someone then simply
keep your mouth shut because it only goes to show how stupid you are.



Wow, very speedy in getting into the old killfile.
*plonk*

Brian


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

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