![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
我叫你一声你敢答应吗?
此人真的很懒,什么都不愿意写!
展开
-
KMP字符串匹配模板 洛谷P3375
#include<iostream> #include<string.h> using namespace std; char a[10000008],b[10000008]; int pi[10000008]; int len1,len2; void BuildPi(char b[],int len){ int i=-1,j=0; pi[0]=0; while(j<len){ if(b[i+1]==b[j+1]){ i++;j++; pi[j]=i+1;原创 2021-04-29 10:48:19 · 97 阅读 · 0 评论 -
栈应用—判断FILO序列
文章目录栈一、题目要求二、代码如下 栈 一、题目要求 输入由A~H打乱顺序的序列,判断是否为FILO序列 例如: 输入:A C B E F D G H 输出:1 输入:A D H C G B E F 输出:0 二、代码如下 #include<iostream> using namespace std; char a[8]; char x,p='A'; int top=0,count=0; int main(){ scanf("%c",&x); while(count&.原创 2021-04-26 19:12:34 · 785 阅读 · 1 评论 -
快速排序和归并排序算法
文章目录一、快速排序(quicksort)二、归并排序(mergesort) 一、快速排序(quicksort) #include <stdio.h> #include <stdlib.h> #pragma comment(linker, "/STACK:1073741824") const int maxn=1000001; int A[maxn]; void swap(int &a, int &b) { int c = a; a = b; b = c;.原创 2021-04-24 23:31:42 · 144 阅读 · 0 评论