跳转到内容

Advertising:

反转

来自GSXAB的知识库
Gsxab留言 | 贡献2025年6月20日 (五) 03:54的版本 (创建页面,内容为“分类:字符串 {{InfoBox |name=反转 |eng_name=reversal }} '''反转'''('''reversal''')指把一个字符串字符顺序反转构成一个字符串的运算。 == 定义 == {{Operation |name=反转 |symbol=<math>^\mathrm{R}</math> |latex=^\mathrm{R} |operand=字符串 |result=字符串 |domain=<math>\Sigma^*</math> |codomain=<math>\Sigma^*</math> }} 对字符串 <math>a = \mathtt{a}_1 \mathtt{a}_2 \cdots \mathtt{a}_n</math> ,称字符串 <mat…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
反转
术语名称 反转
英语名称 reversal

反转(reversal)指把一个字符串字符顺序反转构成一个字符串的运算。

定义

反转
运算名称 反转
运算符号 [math]\displaystyle{ ^\mathrm{R} }[/math]
Latex ^\mathrm{R}
运算对象 字符串
运算元数 2
运算结果 字符串
定义域 [math]\displaystyle{ \Sigma^* }[/math]
陪域 [math]\displaystyle{ \Sigma^* }[/math]

字符串 [math]\displaystyle{ a = \mathtt{a}_1 \mathtt{a}_2 \cdots \mathtt{a}_n }[/math] ,称字符串 [math]\displaystyle{ \mathtt{a}_n \mathtt{a}_{n-1} \cdots \mathtt{a}_1 }[/math] 为字符串的反转(reversal),记作 [math]\displaystyle{ a^\mathrm{R} }[/math]

性质

  • 反转不改变字符串长度,即 [math]\displaystyle{ |a^\mathrm{R}|=|a| }[/math]
    • 空串、长度为 1 的字符串反转保持不变: [math]\displaystyle{ \varepsilon^\mathrm{R} = \varepsilon }[/math] 。有这种性质的字符串称为回文串
  • 对合性[math]\displaystyle{ (a^\mathrm{R})^\mathrm{R} = a }[/math]
  • 与其他字符串运算联系:
    • 连接运算构成的幺半群上是一个反自同态: [math]\displaystyle{ (ab)^\mathrm{R} = b^\mathrm{R} a^\mathrm{R} }[/math]
    • 与幂运算兼容 [math]\displaystyle{ (a^k)^\mathrm{R}=(a^\mathrm{R})^k }[/math]
    • 交换前缀、后缀关系
字符串
特殊字符串 空字符串 [math]\displaystyle{ \varepsilon }[/math]
运算 长度 [math]\displaystyle{ |\bullet| }[/math]
连接 [math]\displaystyle{ \bullet \bullet }[/math]
自连接 [math]\displaystyle{ \bullet^n }[/math] Kleene 闭包 [math]\displaystyle{ \bullet^* }[/math] 、 Kleene+ 闭包 [math]\displaystyle{ \bullet^+ }[/math]
反转 [math]\displaystyle{ \bullet^\mathrm{R} }[/math]
关系 子串 子列
前缀、后缀 公共前后缀

Advertising: