随笔分类 -  Algorithm

algorithms
摘要:在线性时间里求素数表 C++ include include const int maxn = 1000000; bool isPrime[maxn]; int table[maxn]; int cnt; void getPrime() { memset(isPrime,1,sizeof(isPri 阅读全文
posted @ 2018-07-20 13:33 asakuras 阅读(146) 评论(0) 推荐(0)
摘要:排序的同时求逆序数 C++ include include include using namespace std; const int maxn = 1e6 +5; int arr[maxn]; int cnt = 0; void merge_sort(int b, int e) { if(b = 阅读全文
posted @ 2018-06-11 16:29 asakuras 阅读(130) 评论(0) 推荐(0)
摘要:KMP C++ include include void get_next(char p,int next){ int pLen = strlen(p); next[0] = 1; int k = 1,j = 0; while(j 阅读全文
posted @ 2018-06-08 11:29 asakuras 阅读(125) 评论(0) 推荐(0)