数据结构
数据结构
w0nderMaker
pwn新手
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
我的数据结构
#include <iostream>#include<stdlib.h>using namespace std;typedef struct{ int a[100]; int len; int maxz=100;} node;typedef node* list;void _insert(list L){ int x; cin>>x; while(x!=-1) { L->a[L原创 2021-03-18 17:03:25 · 1746 阅读 · 1 评论 -
spfa算法之旅行
#include<bits/stdc++.h>using namespace std;const int maxm=1010;const int maxn=1010;const int inf=0x3f3f3f3f;int head[maxn],vis[maxn][maxn],dis[maxn][maxn];int cnt,n,m;struct node{ int to,next,l;}e[maxm*2];void add(int x,int y,int l){.原创 2021-03-09 21:12:03 · 209 阅读 · 0 评论 -
牛牛的回文串(区间dp)
这个题着实折磨#include<stdio.h>#include<iostream>#include<string.h>#define INF 1e14 #define LL long longusing namespace std;char str[55];LL dp[55][55],cost_add[30],cost[30],cost_err[30],C[30][30];//变换表 //dp[i][j]代表i~j段对称的最小花费 void i.原创 2021-03-06 19:27:51 · 127 阅读 · 0 评论 -
并查集之集合问题
首先知道p[i]≥1,所以不存在p[i]大于等于max(a,b)用map<ll,ll>mp记录下每个p[i]出现的下标,每次找到b-p[i]或a-p[i]都进行一次连接#include <bits/stdc++.h>using namespace std;const int maxn = 1e5+5;int par[maxn];int a[maxn];int n;map<int,int> mp;void init(){ for (int i=0.原创 2021-03-04 23:08:55 · 149 阅读 · 1 评论 -
蚯蚓之队列
那么只要原来的蚯蚓具有单调性,每次只需要找这三个队列的最大值即可至于每次都要增加的长度,我们可以先不加上,等到取出来的时候在加 (i - 1) * q(i−1)∗q, 放回去的时候注意要减去 i * qi∗q#include<bits/stdc++.h>typedef long long ll;using namespace std;const int N = 2e5 + 5;const int mod = 1e9 + 7;queue<ll> q[3];ll a.原创 2021-03-04 22:54:33 · 168 阅读 · 2 评论 -
旅游规划之Dijkstra
#include <iostream>using namespace std;#define INFINITY 100000000struct gnode{ int weight; int expenses;}G[500][500];int nv, ne;int sta, enk;int visit[500] = { 0 };int dist[500], cost[500];void build(){//建立一个表 int v1, v2, w, ex; fo.原创 2021-02-22 19:49:09 · 139 阅读 · 0 评论 -
哈利·波特的考试之Floyd算法
#include <iostream> #include <stdio.h> #include <algorithm> #include <string.h> #define INF 0x3f3f3f3f using namespace std; int dis[102],map[110][110]; int n,m; void floyd(){ int i,k,j; for.原创 2021-02-22 21:02:45 · 134 阅读 · 0 评论 -
最短工期之拓扑排序
#include"iostream"#include"string.h"#include"stack"#include"vector"#include"algorithm"using namespace std;typedef struct node{ int to; int cost;}node;int in[101];int dis[101];stack<int>q;vector<node>t[101];int cnt = 0;void topo.原创 2021-02-24 15:02:16 · 388 阅读 · 0 评论 -
练习4.2 平衡二叉树的根
#include <stdio.h>#include <malloc.h>#define ElemType inttypedef struct BiTNode { ElemType Data; struct BiTNode *Left; struct BiTNode *Right;}*AVLTree;AVLTree SingleLeftRotation(AVLTree T) {//左单旋 AVLTree B=T->Left; ...原创 2021-02-26 17:53:10 · 217 阅读 · 0 评论
分享