数据结构
学术大new牛
无形之刃,最为致命~
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
归并排序
#include <iostream>using namespace std;void Merge(int A[],int low,int mid,int high)//完整的合并程序 { int *B = new int[high-low+1];//申请一个辅助数组 int i = low,j = mid+1,k = 0; while(i <= mid &&...原创 2020-01-11 21:10:43 · 112 阅读 · 0 评论 -
拓扑排序
#include<iostream>#include<cstring>#include<stack>using namespace std;const int MaxVnum=100;//顶点数最大值int indegree[MaxVnum];//入度数组typedef string VexType;//顶点的数据类型为字符型typedef st...原创 2020-01-06 13:48:05 · 190 阅读 · 0 评论 -
hdu 1166线段树
#include<cstdio>#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1const int maxn=55555;int sum[maxn<<2];void PushUP(int rt)//更新和值 { sum[rt]=sum[rt<<1]+sum[rt<&...原创 2020-01-03 20:21:50 · 104 阅读 · 0 评论 -
数据结构的题目
高级数据结构线段树HDU 1166 敌兵布阵HDU 4902 Nice boatPOJ 2777 Count ColorPOJ 3468 A Simple Problem with Integers原创 2020-01-03 10:15:05 · 163 阅读 · 0 评论 -
区间更新,线段树
###区间更新对[l,r]进行区间更新1)如果结点的区间被查询区间[l,r]覆盖,仅对该结点进行更新,并做懒标记,表示该结点被更新过,对该结点的子结点不再进行更新;2)判断在左子树查询,右子树查询。查询过程中,若当前节点带有懒标记,懒标记下传给子结点(当前结点懒标记清除,子结点更新并做懒标记),继续查询;3)更新最值#include<iostream>#include<...原创 2020-01-03 09:43:02 · 157 阅读 · 0 评论 -
单点更新,区间查询线段树
#include<iostream>#include<cstring>#include<algorithm>using namespace std;const int maxn=100005;const int inf=0x3f3f3f3f;int n,a[maxn];struct node//结点{ int l,r,mx,lz;//l,r...原创 2020-01-02 15:12:32 · 143 阅读 · 0 评论 -
二维树状数组
#incude <iostream>#include <cstring>using namespace std;const int maxn = 10000;int n,a[maxn][maxn],c[maxn][maxn];//二维树状数组int lowbit(int i)//区间长度 { return (-i)&i;}void add(in...原创 2019-12-24 22:29:40 · 110 阅读 · 0 评论 -
树状数组
#include <iostream>#include <cstring>using namespace std;const int maxn = 10000;int n,a[maxn],c[maxn],s[maxn];int lowbit(int i) //c[i]的区间长度 { return (-i)&i;}void add(int i...原创 2019-12-24 22:08:33 · 101 阅读 · 0 评论
分享