数据结构
qq_970313613
这个作者很懒,什么都没留下…
展开
-
字典树
字典树的插入以及询问 建立字典树 struct node { int ch[26];//字典树编号为i时储存的字符在字典中与’a’的距离 int end;//表示每一个字典树的叶子节点编号 } tree[maxn]; //tree【i】表示字典树的当前节点编号 int k=0,len;//注意我们对节点的编号要定义全局变量 不然每建立一次新树 我们的编号并没按照顺序来统计 vo...原创 2019-07-25 11:40:18 · 180 阅读 · 0 评论 -
树状数组求逆序对
In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted i...原创 2019-08-02 20:51:57 · 198 阅读 · 0 评论 -
树状数组
还是先看看基础的树状数组坐标是怎么由二进制进化来的 这个大神写的非常基础 https://www.cnblogs.com/xenny/p/9739600.html 我们就是把数组下标为偶数的推到最顶端 我们可以得到以下的关系式: C[1](1) = A[1]; C[2] (10)= A[1] + A[2]; C[3] (11)= A[3]; C[4] (100)= A[1] + A[2] + ...原创 2019-07-26 09:56:39 · 91 阅读 · 0 评论 -
线段树
先看一下几个大大大佬写的博客(易懂): https://www.cnblogs.com/xenny/p/9801703.html https://www.cnblogs.com/jason2003/p/9676729.html 一定要自己手动推一遍递归过程 仔细体会 不要一心着急看完 线段树的建立与区间的查询 区间和的查询: 区间最值的查询: sample input 区间和 6 1 8 ...原创 2019-07-22 20:04:49 · 98 阅读 · 0 评论 -
0-1字典树找亦或最小值
在之前的一篇文章中我们知道如何求求数X在储存了0-1的字典树数组A[I]当中去寻找X与A[i]的最大值 且A[i]是可以进行重复利用的 那么现在我们来求求亦或的最小值问题 先挂出题: Q - Perfect Security Alice has a very important message M consisting of some non-negative integers that she ...原创 2019-07-27 11:05:06 · 239 阅读 · 0 评论