摘要:
KMP KMP算法每当一趟匹配过程中出现字符比较不等时,主串S中的i指针不需回溯,而是利用已经得到的“部分匹配”结果将模式向右“滑动”尽可能远的一段距离后,继续进行比较。 KMP算法的主要核心其实就是next数组的求解 next数组求解 void GetNext(char *w, int n 阅读全文
posted @ 2020-06-06 21:01
Bep
阅读(113)
评论(0)
推荐(0)
摘要:
快速排序模板(C语言) 快排的基本思想是,通过一趟排序将要排序的数据分割成独立的两部分,其中的一部分数据比另一部分的数据都要小,或者都要大,然后再把这两个独立的部分进行快速排序,整个过程可以用递归来进行。 #include<stdio.h> void quicksort(int a[], int l 阅读全文
posted @ 2020-06-06 20:59
Bep
阅读(332)
评论(0)
推荐(0)
摘要:
最长上升子序列 O(nlogn) #include<stdio.h> int a[1005]; int arr[1005]; int len; int Binary_search(int e) { int l, r, mid; l = 0; r = len; while(l <= r) { mid 阅读全文
posted @ 2020-06-06 20:58
Bep
阅读(101)
评论(0)
推荐(0)

浙公网安备 33010602011771号