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 ...
随机推荐
- android开发学习---layout布局、显示单位和如何进行单元测试
一.五大布局(layout) android中的用五大布局:LinearLayout (线性布局).AbsoluteLayout(绝对布局).RelativeLayout(相对布局).TableLay ...
- 学习springMVC框架配置遇到的问题-数据写入不进数据库时的处理办法
配置完了,运行,数据写入不到数据库中,就应该想UserAction 中的handleRequest()方法有没有进去,然后就设置断点.如果发现程序没有进去,就再想办法进去.
- 問題排查:F5啟動偵錯後所提示的錯誤 (1)
原始專案版本:Visual Studio 2005 開發環境:Visual Studio 2013 偵錯運行環境:IIS Express 啟動偵錯後,錯誤提示內容如下: HTTP 错误 500.23 ...
- git常用命令1
git clone #克隆远程仓库的项目到本地 git config --global user.name "" #查看或设置贡献者的名字 git config --gl ...
- asp.net MVC 源码分析
先上一张图吧 asp.net请求机制的图 by传智播客邹华栋老师 然后是 邹老师添加MVC请求过程的图 其实MVC 是在.netframework上加了一个过滤器 HttpModule 在C:\W ...
- Azure IaaS 用户手册 - 第一部分
可用性集 相当于AZ? 能实现跨Rack的可用性? Azure 如何保证 CPU.内存.硬盘的性能? 传统的 Hyper-V 技术,其CPU 是共享的.比如您的 ThinkPad T430S 是 4C ...
- iOS删除本地文件
以前在博客里记录的东西都是截屏,没有插入代码,今天进去一看,图片都不显示了,只好重新插入代码,发现以前写的文件操作这块,没有写本地文件删除这个功能,重新再记录一下 //需要删除文件的物理地址 NSSt ...
- 使用my exclipse对数据库进行操作(1)
一.查找 public class class1 { public static void main(String[] args) { // TODO Auto-generated method st ...
- 【OpenGL】VS2010环境配置 [转]
基于OpenGL标准开发的应用程序运行时需有动态链接库OpenGL32.DLL.Glu32.DLL,这两个文件在安装Windows NT时已自动装载到C:\WINDOWS\SYSTEM32目录下(这里 ...
- PHP异步工作避免程序运行超时
应用案例: 某SNS社区要求用户给自己好友(好友数量上百个)发送邮件,每封邮件内容不一,发送后提示发送完毕! 常用PHP写法 sendmail.php <?php $count=count($e ...