- 1、本文档共13页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
ZOJ上BFS问题
++++++++++++++++++++DEPTH FIRST SEARCH PROBLEMS ON ZOJ++++++++++++++++++++
ZOJ Problem Set – 1004:Anagrams by Stack
Time Limit: 1 Second ???? Memory Limit: 32768 KB
How can anagrams result from sequences of stack operations? There are two sequences of stack operators which can convert TROT to TORT:
[
i i i i o o o o
i o i i o o i o
]
where i stands for Push and o stands for Pop. Your program should, given pairs of words produce sequences of stack operations which convert the first word to the second.
Input
The input will consist of several lines of input. The first line of each pair of input lines is to be considered as a source word (which does not include the end-of-line character). The second line (again, not including the end-of-line character) of each pair is a target word. The end of input is marked by end of file.
Output
For each input pair, your program should produce a sorted list of valid sequences of i and o which produce the target word from the source word. Each list should be delimited by
[
]
and the sequences should be printed in dictionary order. Within each sequence, each i and o is followed by a single space and each sequence is terminated by a new line.
Process
A stack is a data storage and retrieval structure permitting two operations:
Push - to insert an item andPop - to retrieve the most recently pushed item
We will use the symbol i (in) for push and o (out) for pop operations for an initially empty stack of characters. Given an input word, some sequences of push and pop operations are valid in that every character of the word is both pushed and popped, and furthermore, no attempt is ever made to pop the empty stack. For example, if the word FOO is input, then the sequence:
i i o i o o is valid, but i i o is not (its too short), neither is i i o o o i (theres an illegal pop of an empty stack) Valid sequences yield rearrangements of the letters in an input word. For example, the input word FOO and the sequence i i o i o o produce th
您可能关注的文档
- 第15章_ADA转换器接口.ppt
- 第八-1章 中断程序设计.ppt
- 南华大学微机原理汇编实验2及代码实现显示‘hello,world!.doc
- 微机原理考试复习要点.doc
- 王爽《汇编语言》 第3章 寄存器(内存访问).ppt
- 5 汇编语言模块化程序设计.ppt
- 汇编及接口技术课程设计报告.doc
- 微机原理3-2指令系统传送指令.ppt
- 北航微机原理课件第七讲 逻辑运算指令.ppt
- 求出500以内回文数微机原理课程设计说明书.doc
- 2025年蜀道投资集团有限责任公司人员招聘笔试备考题库及1套参考答案详解.docx
- 呼叫中心建设规划.pdf
- 2025年南宁城市建设投资集团有限责任公司人员招聘笔试备考题库含答案详解(完整版).docx
- 2024山东济南先行投资集团有限责任公司及权属公司第一批次社会招聘64人笔试备考试题及答案详解(典优).docx
- 2024山东济南先行投资集团有限责任公司及权属公司第一批次社会招聘64人笔试备考题库含答案详解(黄金题型).docx
- 2025年南京新工投资集团有限责任公司校园招聘笔试备考题库含答案详解(b卷).docx
- 2025年蜀道投资集团有限责任公司人员招聘笔试备考题库参考答案详解.docx
- 医院回访工作总结范文专题合集.pdf
- 2025年南宁威宁投资集团有限责任公司校园招聘笔试备考题库含答案详解(研优卷).docx
- 2025年山东小鸭集团有限责任公司招聘笔试备考试题附答案详解(综合题).docx
文档评论(0)