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 ...
随机推荐
- 解除win7系统静音
#ifdef SPEAKERDEVMUTECONTROL# define SPEAKERDEVMUTECONTROL_EXPORT __declspec(dllexport)#else# define ...
- table的css样式
经常会遇到table中各种线条重复的问题,画面会显得很难看,下面是解决问题的方法: <!Doctype html><html> <head> <meta ch ...
- JavaScript密码复杂度
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8" ...
- html、css、js文件加载顺序及执行情况
HTML页面加载和解析流程 1. 用户输入网址(假设是个html页面,并且是第一次访问),浏览器向服务器发出请求,服务器返回html文件. 2. 浏览器开始载入html代码,发现<head& ...
- 修改eclipse中settings.xml和默认资源库保存地址
1.打开eclipse 2.window-->references-->Maven0-->User Settings:修改User Settings,Browse重新选择新位置D:\ ...
- each函数
- 学习python之练习(三)
python排序算法 1.冒泡排序: import math def BubbleSort(list): lengthOfList = len(list) for i in range(0,lengt ...
- php总体架构图
- 亲子之间,在于看懂,无关耐心zz
每当有人告诉我:『你对孩子真有耐心!』时,我总会想起我的金项链,当越来越多人说的时候,我就越想找出来,我翻箱倒柜的找,越心急却越找不到,那 一条金项链从我十八岁那一年一直戴在我的脖子上一直到女儿两岁, ...
- MySQL关键性能监控(QPS/TPS)
原文链接:http://www.cnblogs.com/chenty/p/5191777.html 工作中尝尝会遇到各种数据库性能调优,除了查看某条SQL执行时间长短外,还需要对系统的整体处理能力有更 ...