摘要: #include <iostream>using namespace std;class A{ public: A(int *data, int len){} }; template<class T> class MaxHeap{ private: T *datas; int MaxSize; int currentSize; void KeepHeap(int root); bool del; public: MaxHeap(int MaxSize); MaxHeap(T *datas, int length); ~... 阅读全文
posted @ 2012-11-09 15:16 xingoo 阅读(293) 评论(0) 推荐(0)
摘要: 语法:add(chara[],charb[],chars[]);参数:a[]: 被乘数,用字符串表示,位数不限b[]: 乘数,用字符串表示,位数不限t[]: 结果,用字符串表示返回值: null注意: 空间复杂度为o(n^2) 需要string.h源程序: #include <iostream>#include <string.h>using namespace std;void add(char a[],char b[],char back[]){ int i,j,k,up,x,y,z,l; char *c; if(strlen(a)>strlen(b)) .. 阅读全文
posted @ 2012-11-09 11:04 xingoo 阅读(360) 评论(0) 推荐(0)
摘要: 问题说明: 若有一只兔子,每月生一只,一个月以后小兔子也开始生产。起初一只兔子,一个月以后两只兔子,两个月以后三只兔子,三个月后五只兔子。。算法描述: 简单的递归即可: #include <stdio.h>#include <stdlib.h>#define N 20int main(){ int Fib[N] = {0}; int i; Fib[0] = Fib[1] = 1; for(i=2;i<N;i++) Fib[i] = Fib[i-1] + Fib[i-2]; for(i=0;i<N;i++) printf("... 阅读全文
posted @ 2012-11-09 10:53 xingoo 阅读(325) 评论(0) 推荐(0)