摘要: #include #include // 集成最快排序与查找 #define NUM 8int compare(const void *p, const void *q){ return (*(int *)p - *(int *)q);}int main(int argc, char *argv[]){ int array[NUM] = {9, 2, 7, 11, 3, 87, 34, 6}; int key; scanf("%d",&key); int *p; qsort(array, NUM, sizeof(int), compare); ... 阅读全文
posted @ 2014-03-29 17:16 xzenith 阅读(170) 评论(0) 推荐(0) 编辑
摘要: bool RabbinMillerTest( unsigned n ){ if (n>= 1; // 右移一位 r++; // 统计右移的次数 } const unsigned nTestCnt = 8; // 表示进行测试的次数 for ( unsigned i = 0; i < nTestCnt; ++i ) { // 利用随机数进行测试, int a = g_aPrimeList[ rand() % nPrimeListSize ]; if ( 1 != Montgomery( a, m, n ) )... 阅读全文
posted @ 2014-03-29 17:09 xzenith 阅读(163) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include int *primarr, *v;int q = 1, p = 1;//π(n)int pi(int n, int primarr[], int len){ int i = 0, mark = 0; for (i = len - 1; i > 0; i--) { if (primarr[i] n) { if (!mark[j]) s++; j--; ... 阅读全文
posted @ 2014-03-29 17:02 xzenith 阅读(131) 评论(0) 推荐(0) 编辑
摘要: #include #include typedef struct stack{ int data; struct stack *next;} STACK;STACK *head, *pr;int nodeNum = 0; /* 堆栈节点数寄存器 */STACK *CreateNode(int num);STACK *PushStack(int num);int PopStack(void);int main(){ int pushNum[5] = {111, 222, 333, 444, 555}, popNum[5], ... 阅读全文
posted @ 2014-03-28 22:38 xzenith 阅读(226) 评论(0) 推荐(0) 编辑