产生字符串翻转和反转的下推自动机
字母表:0, 1
考虑翻转,翻转每个字符:0 -> 1; 1-> 0 因此,如果 w = 0011 则 w-flip = 1100
将反转视为反转顺序的字符 因此,如果 w = 01101 那么 w-reverse = 10110
现在我正在尝试生成一个 PDA,它接受字符串 w,然后打印 w,打印 (w-flip-reversed)
w = 011
w-flip = 100
w-flip-reverse = 001
所以这将打印:“011001”
考虑 # 为一个空白字符。所以一个字符串会开始 #011#
转换表看起来像这样:
State: Symbol Read: Next State: Head Instruction:
start # r1 L
等等
有什么想法吗?
The alphabet: 0, 1
Consider a flip, to flip each character: 0 -> 1; 1 -> 0
So if w = 0011 then w-flip = 1100
Consider a reverse to be the characters in reversed order
So if w = 01101 then w-reverse = 10110
Now I am trying to produce a PDA which takes the string w, and then prints w, prints (w-flip-reversed)
w = 011
w-flip = 100
w-flip-reverse = 001
So this would print: "011001"
Consider # to be a blank character. So a string would start #011#
Transition table looks something like this:
State: Symbol Read: Next State: Head Instruction:
start # r1 L
And so on
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
打印出字符串很简单(我希望)。打印翻转就像在读取
1
时打印0
一样简单,反之亦然。一个让您继续反转的粗略草图:
在您的情况下,您需要将翻转的字符串放入存储中以进行反转。
Printing out the string is simple (I hope). Printing out the flip is as easy as printing out
0
when you read a1
and vice-versa.A rough sketch to get you going on the reversal:
In your case, you'll need to put the flipped string in storage for reversal.