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的更多相关文章

  1. KMP string pattern matching

    The function used here is from the leetcode. Details can be found in leetcode problem: Implement str ...

  2. Beginning Scala study note(5) Pattern Matching

    The basic functional cornerstones of Scala: immutable data types, passing of functions as parameters ...

  3. scala pattern matching

    scala语言的一大重要特性之一就是模式匹配.在我看来,这个怎么看都很像java语言中的switch语句,但是,这个仅仅只是像(因为有case关键字),他们毕竟是不同的东西,switch在java中, ...

  4. [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 ...

  5. [Scala] Pattern Matching(模式匹配)

    Scala中的match, 比起以往使用的switch-case有著更強大的功能, 1. 傳統方法 def toYesOrNo(choice: Int): String = choice match ...

  6. pattern matching is C# 7.0

    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/is 原来的版本 private static s ...

  7. C#9.0 终于来了,带你一起解读Pattern matching 和 nint 两大新特性玩法

    一:背景 1. 讲故事 上一篇跟大家聊到了Target-typed new 和 Lambda discard parameters,看博客园和公号里的阅读量都达到了新高,甚是欣慰,不管大家对新特性是多 ...

  8. Zhu-Takaoka Two-dimensional Pattern Matching

    Two dimensional pattern matching. Details may be added later.... Corresponding more work can be foun ...

  9. 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 ...

随机推荐

  1. display 显示隐藏 ESAYuI

    $("#rejectCauseDisplay").css('display',"block");     $("#rejectCauseDisplay ...

  2. 算法与数据结构实验题6.4 order (二叉树)

    1.题目: 2.代码: #include<iostream> #include<algorithm> using namespace std; struct Node { in ...

  3. UzysAssetsPickerController中文化

    self.labelSelectedMedia.text = NSLocalizedStringFromTable(@"Choose a media", @"UzysAs ...

  4. ArcGIS删除部分数据后全图范围不正确

      我有一个全国地图的图层,现在删除图层中其他省份,只保留山东省的图形,但是点击全图后,全图范围仍然是全国地图时候的全图范围,使用的版本是ArcGIS9.3,数据存放在9.3的个人数据库中(Perso ...

  5. [golang]反射的用处--代码自动生成

    背景: go语言处理db.json的时候,具体代码的变量定义和db字段.json输出的时候可能不一样. 这个时候,我们需要用tag的方式来进行定义. 例如: type MyStruct struct ...

  6. Markdown常用基本语法

    现在是我在学习Markdown时做的笔记.学完这些Markdown的基本使用已经不成问题. 1. 标题设置(让字体变大,和word的标题意思一样)在Markdown当中设置标题,有两种方式:第一种:通 ...

  7. [VBS]关机恶作剧

    一.关于脚本 1)本文中的脚本完成以下功能: 随机生成3道二位数加法题,如果答题错误则在60秒后关机. 如果全答对了,也会在60后关机,但脚本会提示解除定时关机的办法 2)在脚本运行过程中,退出本脚本 ...

  8. Linux内核实现中断和中断处理(一)

    Linux实现中断处理 内核是怎么知道应用程序要调用系统调用的呢?或者说应用程序怎么通知系统内核自己需要执行一个系统调用,这是通过软中断实现的,通过引发一个异常来促使系统切换到内核态去执行异常处理程序 ...

  9. Java起源、发展历程、环境变量、第一个Java程序等【1】

    若有不正之处,请多多谅解并欢迎批评指正,不甚感激. 请尊重作者劳动成果,转载请标明原文链接: 本文原创作者:pipi-changing 本文原创出处:http://www.cnblogs.com/pi ...

  10. iOS9的一些问题

    1.App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. ...