Symbols of String Pattern Matching
Symbols of String Pattern Matching in Introduction to Algorithms.
As it's important to be clear when discussing the problem of string matching, we can use the meticulous symbols used in Introduction to Algorithms.
Text: $T[1, ..., n]$.
Pattern: $P[1, ..., m]$.
Thus, as $T[i], P[j] \in \Sigma$, the array of letters, like $T[1, ..., n]$ or $P[1, ..., m]$, is called string.
Alphabet: $\Sigma$.
Set of all finite length of strings: $\Sigma^*$.
Define the empty string $\epsilon$, as it is a string, we also have $\epsilon \in \Sigma^*$.
Shifting $s$ matching: $T[s+1, s+2, ..., s+m] = P[1, 2, ..., m]$.
$\omega$ is the prefix of string x: Existing a string $y\in \Sigma^*$, such that $x=\omega y$, marked as $\omega \sqsubset x$.
$\omega$ is the suffix of string x: Existing a string $y\in \Sigma^*$, such that $x=y \omega$, marked as $\omega \sqsupset x$.
Define $P_k$ as the prefix $P[1, ..., k]$ of string $P[1, ..., m]$. Thus we have: $P_0 = \epsilon, P_m = P = P[1, ..., m]$.
Based on the above symbols, the matching problem can be restated as:
Finding all the possible shifting values $s$, such that $P \sqsupset T_{m+s}$.
Symbols of String Pattern Matching的更多相关文章
- KMP string pattern matching
The function used here is from the leetcode. Details can be found in leetcode problem: Implement str ...
- Beginning Scala study note(5) Pattern Matching
The basic functional cornerstones of Scala: immutable data types, passing of functions as parameters ...
- scala pattern matching
scala语言的一大重要特性之一就是模式匹配.在我看来,这个怎么看都很像java语言中的switch语句,但是,这个仅仅只是像(因为有case关键字),他们毕竟是不同的东西,switch在java中, ...
- [PureScript] Break up Expressions into Cases in PureScript using Simple Pattern Matching
Pattern matching in functional programming languages is a way to break up expressions into individua ...
- [Scala] Pattern Matching(模式匹配)
Scala中的match, 比起以往使用的switch-case有著更強大的功能, 1. 傳統方法 def toYesOrNo(choice: Int): String = choice match ...
- pattern matching is C# 7.0
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/is 原来的版本 private static s ...
- C#9.0 终于来了,带你一起解读Pattern matching 和 nint 两大新特性玩法
一:背景 1. 讲故事 上一篇跟大家聊到了Target-typed new 和 Lambda discard parameters,看博客园和公号里的阅读量都达到了新高,甚是欣慰,不管大家对新特性是多 ...
- Zhu-Takaoka Two-dimensional Pattern Matching
Two dimensional pattern matching. Details may be added later.... Corresponding more work can be foun ...
- TypeError: cannot use a string pattern on a bytes-like object的解决办法
#!/usr/python3 import re import urllib.request def gethtml(url): page=urllib.request.urlopen(url) ht ...
随机推荐
- delphi日期格式化免操作系统依赖单元
delphi免操作系统依赖单元 经常在windows里面,我们需要yyyy-mm-dd格式日期,可是用户却没有设置成这个 格式,而用程序去修改用户的日期格式设置,是不明智的,将影响其他程序的运行. 本 ...
- Daily Scrum 12.9
今日完成任务: 修复了提交回答,自动消除换行符,导致文本显示混乱的BUG.解决个人信息修改界面中,问题显示顺序不对的BUG.基本完成数据库接口webservice工作.但引入的异常还未修复. 遇到困难 ...
- javascript第四节其它引用对象
单体对象 Global对象(全局)这个对象不存在,无形的对象 其内部定义了一些方法和属性:encodeURL.encodeURIComponent.decodeURI.decodeURICompone ...
- ActiveX控件dsoFramer的使用(word、excel、PPT)
dsoframer是微软提供一款开源的用于在线编辑.调用Word. Excel .PowerPoint等的ActiveX控件.国内很多著名的OA中间件,电子印章,签名留痕等大多数是依此改进而来的. 一 ...
- 分布式日志1 用c#的队列写日志
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- Centos6.X下安装php nginx mysql 环境
---------------------------------------更换163软件源,此步可以省略,记得把repo文件里面的6.5改成当前版本号 yum makecache &&am ...
- Linux内核实现中断和中断处理(一)
Linux实现中断处理 内核是怎么知道应用程序要调用系统调用的呢?或者说应用程序怎么通知系统内核自己需要执行一个系统调用,这是通过软中断实现的,通过引发一个异常来促使系统切换到内核态去执行异常处理程序 ...
- css标签选择器的优先级
1.行内样式>嵌入式>外部样式(就近原者) 当外部样式在嵌入式的前面时就是外部样式为主 2.重复样式p{color:red}p{color:green}<p>是green< ...
- oracle添加和查看注释
1.给表加注释 COMMENT ON TABLE TABLENAME IS '用户表'; 2.查看表的COMMENT SELECT * FROM USER_TAB_COMMENTS WHERE TAB ...
- MySQL调优参数
key_buffer_size 含义:用于索引块的缓冲区大小,增加它可得到更好处理的索引(对所有读和多重写). 影响:对于MyISAM表的影响不是很大,MyISAM会使用系统的缓存来存储数据,所以大量 ...