声明函数指针的数组类似声明一般的指针数组。接上文例子将其改进为使用函数指针的数组,代码如下:
#include
using std::cout;
using std::endl;
//函数声明
double squared(double);
double cubed(double);
double sum_array(double array[],int len,double (*...
分类:
编程语言 时间:
2014-06-22 22:46:44
阅读次数:
264
??
set_union
算法set_union可构造S1、S2的并集。此集合内含S1或S2内的每一个元素。S1、S2及其并集都是以排序区间表示。返回值是一个迭代器,指向输出区间的尾端。
由于S1和S2内的每个元素都不需唯一,因此,如果某个值在S1出现n次,在S2出现m次,那么该值再输出区间中会出现max(m,n)次,其中n个来自S1,其余来自S2。在STL
se...
分类:
其他好文 时间:
2014-06-22 22:22:27
阅读次数:
240
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum...
分类:
其他好文 时间:
2014-06-22 20:59:24
阅读次数:
227
最近在客户的一个8i生产库上使用statspack,发现alert中有报错:
Mon Jun 16 13:17:52 2014
Errors in file /oracle/8.1.7/admin/prod/bdump/snp0_96626_prod.trc:
ORA-12012: error on auto execute of job 304
ORA-01631: max # exte...
分类:
数据库 时间:
2014-06-22 20:40:40
阅读次数:
316
题目:
有n件物品和一个容量为C的背包。(每种物品均只有一件)第i件物品的体积是v[i],重量是w[i]。选一些物品装到这个背包中,使得背包内物品在总体积不超过C的前提下重量尽量大。
解法:两种思路:
第一种:d(i, j)表示“把第i,i+1,i+2,...n个物品装到容量为j的背包中的接下来的最大总重量”。
d(i, j) = max{d(i+1, j), ...
分类:
其他好文 时间:
2014-06-22 19:49:37
阅读次数:
137
The partial sum problem
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述One day,Tom’s girlfriend give him an array A which contains N integers and asked him:Can you choose some integers from the N ...
分类:
其他好文 时间:
2014-06-22 18:00:48
阅读次数:
166
nucleus系统是实时嵌入式操作系统,具有实时、任务抢先、多任务内核,其中95%的代码由C语言写成,极易移植,开放的源码使得配置和裁剪方便,再加上体积小(全部二进制映像可仅20K)、响应快速等特性,使得Nucleus PLUS得到广泛应用。本文总结了Nucleus PLUS的启动流程、运行线程和中断处理机制。...
分类:
编程语言 时间:
2014-06-22 14:53:02
阅读次数:
249
nginx作为web服务器,wordpress上传主题报错 413 Request Entity Too Large
解决:
vim /usr/local/nginx/conf/nginx.conf ’编辑nginx配置文件
client_max_body_size 20m; ‘在http段落里添加这一句后保存退出
/usr/local/nginx/sbin/nginx -s reload...
分类:
其他好文 时间:
2014-06-22 14:38:34
阅读次数:
203
(二叉)堆是一个数组,是一颗近似完全二叉树,分为大顶堆&小顶堆。表示堆的数组A有两个属性:(1)A.length表示数组元素的个数;(2)A.heap-size表示有多少个堆元素存储在数组A中。更多的关于堆的性质的介绍:算法导论第三版:p85-p89、编程珠玑:p141-p145。
堆的操作主要包括堆插入、堆删除两个,而堆插入设计到FixUp操作(自底向上调整),堆删除涉及到FixDown操作(自顶向下调整,大顶堆时对应算法导论上的MAX-HEAPIFY操作)。
本文主要给出的是大顶堆和小顶堆的基本操作的C...
分类:
其他好文 时间:
2014-06-22 13:58:41
阅读次数:
158
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ ...
分类:
其他好文 时间:
2014-06-21 22:44:58
阅读次数:
266