Goodspeed

导航

2013年9月1日 #

字符串匹配的KMP算法——Python实现

摘要: #! /usr/bin/python# coding=utf-8"""基于这篇文章的python实现http://blog.sae.sina.com.cn/archives/307"""import unittestdef pmt(s): """ PartialMatchTable """ prefix = [s[:i+1] for i in range(len(s)-1)] postfix = [s[i+1:] for i in range(len(s)-1)] inter 阅读全文

posted @ 2013-09-01 21:16 Goodspeed 阅读(3980) 评论(5) 推荐(0) 编辑