![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
algorithm
文章平均质量分 69
john_and_betty
这个作者很懒,什么都没留下…
展开
-
编程珠玑第一章习题
2、用位逻辑运算实现,使用位逻辑运算实现位向量所指实现位向量的设置,清零以及探测功能。#define BITPERWORD 32#define SHIFT 5#define MASK 0x1F#define N 10000000int a[1+N/BITPERWORD]//设置数组第i位为1void set(int i){ a[i>>SHIFT] |= (1<<转载 2014-03-12 21:33:20 · 425 阅读 · 0 评论 -
扫描算法 编程珠玑
编程珠玑第八章,maxsofar保存的是第i个元素之前的最大子数组和maxsofar=0maxendinghere=0for i=[0,n) maxendinghere=max(maxendinghere+x[i],0) maxsofar=max(maxsofar,maxendinghere)for(int i=0; i<len; ++i ){原创 2014-03-09 23:26:08 · 535 阅读 · 0 评论