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 ...
随机推荐
- 奔小康赚大钱 hdu 2255( KM )
http://acm.split.hdu.edu.cn/showproblem.php?pid=2255 带权匹配问题: #include <stdio.h> #include <a ...
- document.referrer 特性
最近需要用到document.referrer,但是在测试的时候,总是获取为空,百思不得其解. 于是发动百度,看了大量的文章没有一个说到点子上是为什么,后来偶然看到document.referrer ...
- 【转】sudo命令情景分析
文章转自:http://www.cnblogs.com/hazir/p/sudo_command.html Linux 下使用 sudo 命令,可以让普通用户也能执行一些或者全部的 root 命令.本 ...
- 万万没想到,3D打印居然可以做这些逆天设计
3D打印一直被冠以“高科技”头衔,似乎离我们的日常生活还很遥远.其实不然,随着技术的创新,3D打印技术逐渐深入各个领域,工业生产.商业.医学.建筑.艺术等领域都能看到3D打印技术的影子.它将会改变我们 ...
- 关于e^PI>PI^e
- [转]关闭ORACLE数据库
SQL> shutdown immediateORA-24324: 未初始化服务句柄ORA-24323: 不允许此值ORA-01090: 正在关闭 - 不允许连接 SQL> shutdow ...
- wamp链接mysql数据库
一:链接到自带的数据库 1.打开mysql命令行 密码为空即回车2.输入use mysql 3.执行 update user set password=PASSWORD('123456') where ...
- Android--持久化技术
1.Android中的持久化技术主要有三种: 1)文件存储: 2)SharedPreference存储: 3)数据库存储(SQLite);2.文件存储: 1)Context 类中提供了一个 openF ...
- Android--Activity
1.Activity:它是一种包含用户界面的组件,主要用于和用户进行交互: Activity的用法与步骤: 1)新建类MyActivity.java,继承Activity类: 2)创建布局文件myac ...
- 谈谈自己了解的spring.NET的依赖注入
spring.net里实现了控制反转IOC(Inversion of control),也即依赖注入DI(Dependency Injection),以达到解耦的目的,实现模块的组件化.程序 ...