
算法模板
东风中的蒟蒻
这个作者很懒,什么都没留下…
展开
-
质数线性筛
class Solution {public: static const int N = 1e7; int primes[N], cnt; int st[N]; void getPrimes(int n) { for (int i = 2; i < n; i ++) { if (!st[i]) { primes[cnt ++] = i; }原创 2021-04-16 21:19:53 · 280 阅读 · 0 评论 -
快排
void quickSort(int *array, int left, int right){ if(left < right) { int pivot = array[left]; int low = left, high = right; while(low < high) { while(array[high] >= pivot && low < high) high--; array[low] = array[hig原创 2021-04-12 20:30:35 · 262 阅读 · 0 评论