- 博客(5)
- 资源 (5)
- 收藏
- 关注
原创 素数打表法(防止超时)
//打表法,用函数的下标表示你要判断的数,里面装的是0or1,0代表不是素数,1反之; int a[70000]; //需要多大的数组自己定义 int sushu() //在主函数要调用 { int i,j; a[0]=a[1]=0; //0,1均不是素数 for(i=2;i<=70000;i++) { for(j=2;j<=i/2
2013-08-17 16:34:48
1082
原创 二叉树的遍历(代码实现)
#include #include #include #include using namespace std; typedef char DataType; typedef struct node //定义树(用链表) { DataType data; struct node *lchild,*rchild; }BitreeNode; BitreeNode *CreatBitr
2013-08-16 20:04:35
869
原创 The number of steps
Description Mary stands in a strange maze, the maze looks like a triangle(the first layer have one room,the second layer have two rooms,the third layer have three rooms …). Now she stands at the to
2013-08-13 16:06:11
1012
原创 快速排序 代码实现
void quickSort(int a[],int l,int r) //a[]是要排序的数组, { int i,j,x; if(l<r) { i=l; j=r; x=a[l]; //另a[l]为基数 while(j>i) { while(j>i&&a[j]>=x)
2013-08-10 11:04:22
799
原创 快排模板
int partition(int *a,int left,int right) { a[0] = a[left]; //设置a[left]为主键值,存于a[0],即以a[left]值将[left,right]区间一分为 while(left<right) { while(left=a[0]) right--; //从右边开始找到比主键值a[0
2013-08-07 15:04:42
926
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人