基本数据结构
文章平均质量分 62
数据结构学习笔记,长期更新~
朝花夕拾喵
这个作者很懒,什么都没留下…
展开
-
朝花夕拾喵の单调队列
#include<stdio.h> #include<algorithm> #include<functional> const int MAXn = 5e6 + 5; int read() { int w = 0, r = 0; char ch = getchar(); while (ch < '0' || ch >'9')w |= ch == '-', ch = getchar(); while (ch >= '0' && c原创 2021-06-09 22:15:49 · 108 阅读 · 0 评论 -
堆、优先队列极其应用
循环实现: //省略头文件 #define ls(x) (x<<1) #define rs(x) (x<<1|1) #define fa(x) (x>>1) class Heap { public: int a[(unsigned int)1e6 + 5], size; void insert(int num) {//num x size 分别是欲插入的数、位置、堆长度 int x = ++size; while (a[fa(x)] > num &原创 2021-06-01 11:14:25 · 127 阅读 · 0 评论