您的位置:首页 > 其它

求一个二进制数的(二进制表示)的所有子集

2013-06-14 14:32 309 查看
http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=bitManipulation

iterate over all the subsets of a particular subset (represented by a bit pattern)

So the iteration step is just i
= (i - 1) & superset.

for(s = superset; s >= 0; s = s?((s-1)&superset): -1){

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐