首页 > 编程语言 > 详细

[ Python ] KMP Algorithms

时间:2018-05-18 15:03:05      阅读:144      评论:0      收藏:0      [点我收藏+]
 1 def pmt(s):
 2     """
 3     :param s: the string to get its partial match table
 4     :return: partial match table
 5     """
 6     prefix = [s[:i + 1] for i in range(len(s) - 1)]
 7     suffix = [s[i + 1:] for i in range(len(s) - 1)]
 8     intersection = set(prefix) & set(suffix)
 9     if intersection:
10         return len(max(intersection))
11     else:
12         return 0
13 
14 def kmp(source, target):
15     for i in range(len(source)):
16         pass

 

[ Python ] KMP Algorithms

原文:https://www.cnblogs.com/coder211/p/9055977.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!