![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
lancetop-stardrms
这个作者很懒,什么都没留下…
展开
-
快速排序(C实现)
#include <stdio.h> void qsort(int arr[], int start, int end) { if (start >= end-1) return; int left = start; int right = end-1; int tmp = arr[start]; while (left < right) { while (arr[right]>tmp && right.原创 2022-01-17 16:50:09 · 382 阅读 · 0 评论 -
KMP算法(c++实现)
/** * 算法名称:KMP * 算法目的:给出字符串str,和模式串ptr,要求找出str中ptr的匹配位置和个数 * 算法思想: * 1、定义k为模式串失配位置j的前j-1长度子串的最大相等前后缀长度,(比如abcab最大前后缀长度为2) * 2、当模式串在j位置失配时,模式串相对字符串str向后移动(子串长度-k)个位置(因为k为前j-1子串的最大前后缀长度, *...原创 2018-03-22 17:22:42 · 224 阅读 · 0 评论 -
一般常量表示
const int INF = 0x3f3f3f3f; const long long INF_LL = 0x3f3f3f3f3f3f3f3fLL; const int MOD = int(1e9 + 7); const long long MOD_LL = 1000000000000000007LL; const double EPS = 1e-9; const double PI = aco...原创 2019-04-04 16:00:07 · 358 阅读 · 0 评论