![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
我不吃海鲜
这个作者很懒,什么都没留下…
展开
-
HDOJ 1022 数据结构 栈
没做51,做HD开始写博客了。结果谢了半天都是水题。尴尬,这道题其实说白了就是栈,o1是进栈的顺序,o2是要求的出栈的顺序,其实意思就是能不能按照那个顺序出栈。这题思路就是按照o1的进来,然后对着o2进行出栈操作,最后出完了就是YES,没出就是NO。#include <iostream>#include <string.h>using namespace std ;typedef long l原创 2017-12-04 14:53:00 · 403 阅读 · 0 评论 -
数据结构 KMP
题目:从一个字符串找到最长的重复字符串并返回第一个字符的位置。思路一:暴力,不做太多解释。思路二:根据字符串的查找理所当然想到KMP,KMP的next数组,next[i]=k,从该字符串头结点开始的后k个结点与i结点往前k个字符串相同,很明显了。然后遍历再调整一下Getnext函数让其返回此次计算的最大值就行了。#include <stdio.h> #include ...原创 2018-10-25 21:23:56 · 219 阅读 · 0 评论 -
数据结构 并查集+路径压缩+重量权衡规则
题目:使用重量权衡合并规则和路径压缩对数据进行归并,并且给出父亲指针表示法数组。#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm>#include <math.h>#include <map>...原创 2019-04-17 18:50:17 · 2885 阅读 · 0 评论 -
数据结构 将带度数的后根次序法表示的森林用兄弟孩子表示
题目:将带度数的后根次序法表示的森林用兄弟孩子表示#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm>#include <math.h>#include <map> #include <vec...原创 2019-04-17 18:50:09 · 496 阅读 · 0 评论 -
数据结构 将树变二叉树
#include <stdio.h> #include <string.h> #include <iostream> #include <algorithm>#include <math.h>#include <map> #include <vector> #define PI acos(-1...原创 2019-04-17 18:50:00 · 190 阅读 · 0 评论