随笔分类 - 可持久化数据结构
高级数据结构
摘要:四种类型的第k小数 1、静态整体Kth 很简单...sort一遍就好了。 时间复杂度O(nlogn) 空间复杂度O(n) 2、动态整体Kth 2.1离散化后开一棵权值线段树,每个位置的值表示这个位置对应的那个数(离散化后的)有多少个,向上维护和; 查询时先查询左子树和sum,比较k和sum的大小:若
阅读全文
摘要:P1177 【模板】快速排序 //动态开点线段树,指针版 #include<bits/stdc++.h> using namespace std; const int maxn=100010; typedef struct node{ int cnt; node* ls; node* rs; }no
阅读全文
摘要:P3919 【模板】可持久化线段树 1(可持久化数组) #include<cstdio> #include<cstring> #include<iostream> #define R register int using namespace std; const int N=1000009,M=50
阅读全文