码迷,mamicode.com
首页 >  
搜索关键字:using    ( 53562个结果
C++跟我一起透彻理解虚函数表
//首先让我们来了解类对象的构造顺序。 #include using namespace std; class A { public: A(){ cout << "A" << endl; } virtual void PrintfA() = 0; }; class B { public: B(){ cout << "B" << endl; } }; c...
分类:编程语言   时间:2015-06-28 12:39:57    阅读次数:139
InsertSort
#include #include using namespace std; int a[10000]={-1,4,5,2,1,3,7}; int n=5; void Is(){ for(int i=2;i<=n;i++){ if(a[i]<a[i-1]){ a[0]=a[i]; a[i]=a[i-1]; ...
分类:其他好文   时间:2015-06-28 11:19:59    阅读次数:122
欧拉函数代码实现
欧拉函数ph(n)的意思是所有小于n且与n互质的个数。 比如说ph(10) = 4{1,,3,7,9与12互质} 欧拉公式 :    a^ph(m) = 1(mod m); 代码实现: //筛选法打欧拉函数表 #include #include #include #include #include using na...
分类:其他好文   时间:2015-06-28 11:19:56    阅读次数:176
队列的链式实现
队列的链式实现:在这个队列里面:r 为低, f 为顶//队列(链式)#include using namespace std;typedef int DataType;struct QNode{ DataType data; struct QNode *link;};typedef st...
分类:其他好文   时间:2015-06-28 11:14:30    阅读次数:95
栈的c语言实现
#include using namespace std; #define STACK_INIT_SIZE 10 #define STACKINCREMENT 10 #define ElemType int typedef struct { ElemType *base; int top; size_t capacity; }SqStack; bool IsFull(SqStack *...
分类:编程语言   时间:2015-06-28 01:17:11    阅读次数:205
Qsort
/**快速排序*/ #include #include using namespace std; int a[]={5,2,1,3,4,6,8,9,10}; int f(int l,int h){ int p=a[l],x=a[l]; while(l<h){ while(l=p) --h; a[l]=a[h]; while(l<h&&...
分类:其他好文   时间:2015-06-28 00:09:30    阅读次数:180
堆排序
/**堆排序*/ /**顺序表存储*/ #include #include #define LT(a,b) ((a)<(b)) using namespace std; int a[]={9,5,2,1,3,4,6,8,9,10}; int n=5; void f(int s,int m){ /**使a[s...m]成为一个大顶堆*/ int c = a[s]; for(i...
分类:编程语言   时间:2015-06-28 00:08:36    阅读次数:202
SelectSort
/**简单选择排序*/ #include #include using namespace std; int a[]={5,2,1,3,4,6,8,9,10}; void f(int n){ for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++) if(a[j]<a[i]) swap(a[j],a[i]); ...
分类:其他好文   时间:2015-06-28 00:07:40    阅读次数:171
hdu 2066 一个人的旅行
最短路问题,果然好久不做都忘得差不多了,跑一次Dijkstra算法把所有点的最短距离都跑出来 #include #include #define maxn 1005 #define inf 1<<30 using namespace std; int t,s,d; int mapp[maxn][maxn]; int w[maxn]; int visit[maxn]; int di[maxn]; ...
分类:其他好文   时间:2015-06-27 22:54:30    阅读次数:121
区间重合判断[poj2808 校门外的树]
题目:http://bailian.openjudge.cn/practice/2808/参考了文章,重写了代码:http://www.cnblogs.com/youxin/p/3266617.html(注:原文解法2代码有误)解法1:以空间换时间#include using namespace s...
分类:其他好文   时间:2015-06-27 22:45:20    阅读次数:153
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!