字符串最小表示法
文章平均质量分 55
圣诞老人家
这个作者很懒,什么都没留下…
展开
-
最小表示法详解
有一个字符串,这个字符串的首尾是连在一起的,要求寻找一个位置,以该位置为起点的字符串的字典序在所有的字符串中中最小。【暴力算法】:O(n)的时间枚举起始位置,O(n)的时间比对字符串的字典序,总的时间复杂度是O(n*n)。【线性算法】:初始时,让i=0,j=1,k=0,其中i,j,k表示的是以i开头和以j开头的字符串的前k个字符相同分为三种情况1.如果str[i+k]==str[j+k] k++。...原创 2017-02-08 00:33:11 · 6650 阅读 · 6 评论 -
poj 1509 最小表示法
Once upon a time there was a famous actress. As you may expect, she played mostly Antique Comedies most of all. All the people loved her. But she was not interested in the crowds. Her big hobby were b原创 2017-02-08 00:37:53 · 241 阅读 · 0 评论