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]Σ, the array of letters, like T[1,...,n] or P[1,...,m], is called string.

 

Alphabet:  Σ.

Set of all finite length of strings:  Σ.

Define the empty string ϵ, as it is a string, we also have ϵΣ.

 

Shifting s matching:  T[s+1,s+2,...,s+m]=P[1,2,...,m].

 

ω is the prefix of string x:  Existing a string yΣ, such that x=ωy, marked as ωx.

ω is the suffix of string x:  Existing a string yΣ, such that x=yω, marked as ωx.

 

Define Pk as the prefix P[1,...,k] of string P[1,...,m]. Thus we have: P0=ϵ,Pm=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 PTm+s.

 

posted @   kid551  阅读(168)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 上周热点回顾(3.3-3.9)
点击右上角即可分享
微信分享提示