![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
左神进阶班代码
就叫温华啦
这个作者很懒,什么都没留下…
展开
-
左神进阶班- manacher 找到字符串的最长回文子串的长度
#include<iostream>#include<string>#include<algorithm>#include<limits>using namespace std;//在字符串之间插入字符,从而 奇偶回文串都能识别char* manacherString(string str){ int length = str....原创 2019-03-29 18:36:31 · 254 阅读 · 1 评论 -
左神进阶班-最大异或和 的分割 个数
#include<iostream>#include<unordered_map>#include<algorithm>using namespace std;int getMaxLen(int arr[], int length){ if(length == 0) return 0; unordered_map<int,int&g...原创 2019-04-04 11:52:46 · 221 阅读 · 0 评论 -
左神 进阶班 - 子数组、子串问题的统一解法(子数组为aim的最大长度)
该方法 的统一解法为:计算每个位置结尾的情况下所求出的答案,然后总的答案必在其中。#include<iostream>#include<unordered_map>#include<algorithm>using namespace std;int getMaxLen(int arr[], int aim, int length){ i...原创 2019-04-04 11:57:21 · 141 阅读 · 0 评论 -
左神进阶班 - KMP算法
getNextArray(): 输入一个要找的字符串,输出其Next数组。getIndexOf(): 输入两个字符串。在str1 中找str2,如果找到了,返回str2在str1中的开始位置。#include<iostream>#include<string>using namespace std;int* getNextArray...原创 2019-03-28 11:08:51 · 939 阅读 · 0 评论 -
左神进阶班 - BFPRT算法:在无序数组中 找第I个大的数(O(n))
#include<iostream>#include<algorithm>using namespace std;int getMedian(int arr[], int begin, int end);int* partition(int arr[],int L, int R, int pivotvalue);void swap(int arr[], i...原创 2019-04-02 10:04:38 · 340 阅读 · 0 评论 -
左神进阶班 -morris 遍历: 带你装* 带你飞
基本模板:3条规则:1.如果 当前节点没有左子树 ,直接去右节点。2.如果当前节点有左子树:则找到该左子树的最右节点: 如果最右节点的右指针为nullptr,则改为指向当前节点,如果最右节点的右指针指向当前节点,则改为指向nullptr。//基本框架//morris 遍历的核心 在于 怎么从 递归 时打印的位置 去理解 先序 中序 后序的打印时机,从而明白 morr...原创 2019-04-02 15:46:26 · 548 阅读 · 0 评论 -
manacher算法解释
代码解释:源码:#include<iostream>#include<string>#include<algorithm>#include<limits>using namespace std;//在字符串之间插入字符,从而 奇偶回文串都能识别char* m...原创 2019-07-18 13:01:40 · 176 阅读 · 0 评论