随笔分类 -  Algorithm

摘要:一幅图让你彻底理解KMP算法(转) http://v.atob.site/kmp-next.html KMP算法最难理解的莫过于next数组。为什么在p[j]!=p[k]时,需要将k赋值为next[k]?通过一副图分析了KMP算法中next数组的计算原理,指出next[k]表示的就是字符串长度为k的 阅读全文
posted @ 2017-05-16 12:10 roadmap 阅读(190) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <stdlib.h>#include <time.h>#include <assert.h>#include <assert.h>#include <string.h>enum { BLACK, RED};enum { LEFT, RIGHT}; 阅读全文
posted @ 2017-04-23 15:43 roadmap 阅读(228) 评论(0) 推荐(0)
摘要:NULL 阅读全文
posted @ 2017-04-14 20:27 roadmap 阅读(100) 评论(0) 推荐(0)
摘要:NULL 阅读全文
posted @ 2017-04-12 20:12 roadmap 阅读(89) 评论(0) 推荐(0)
摘要:NULL 阅读全文
posted @ 2017-04-12 13:43 roadmap 阅读(108) 评论(0) 推荐(0)
摘要:NULL 阅读全文
posted @ 2017-04-12 13:43 roadmap 阅读(88) 评论(0) 推荐(0)
摘要:递归实现: #include <stdio.h>int arr[10] = {3, 2, 4, 1, 9, 7, 5, 6, 0, 8};void print_array(){ int i = 0; for (i = 0; i < 10; i++) printf("arr[%d]:%d ", i, 阅读全文
posted @ 2017-04-12 13:42 roadmap 阅读(120) 评论(0) 推荐(0)
摘要:#include <stdio.h>int arr[10] = {3, 2, 4, 1, 9, 7, 5, 6, 0, 8};void print_array(int arr[], int num){ int i = 0; for (i = 0; i < num; i++) printf("arr[ 阅读全文
posted @ 2017-04-12 13:27 roadmap 阅读(134) 评论(0) 推荐(0)