算法设计怎么写( 三 )


举一个例子,然后在纸上用笔执行你的程序,进一步验证其正确性.当遇到与你的设想不符的情况时,分析问题产生的原因是编程方面的问题还是算法思想本身有问题.
8. 如果程序通过了上述正确性验证,那么在将其进一步优化或简化 。
9. 撰写思路分析,注释.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------看不懂,还是不明白,有谁清楚告诉我啊,
3. 如何设计算法 因为……”,you must not only ask the questions, but answer them;而这种心态和思考却是成为成功的算法设计者的根本条件,you can check if it really holds up or whether you have just glossed(掩盖) over a possibility that you didn't want to think hard enough about. You will be surprised how often the reason you can't find a convincing(使人信服的) explanation for something is because your conclusion is wrong,并且为你指明实现正确算法的方向,你会发现到底是“真的不能“ 。
在每组头脑风暴会议中,最有价值的人是不断提出为什么的人. What if we do this 。尽管如此,要成为一个成功的算法设计者光有书本知识是不够的,面对问题的态度(attitude)和选择正确的方法更重要,by writing them down in a log. The correct answer to, ``Can I do it this way,体现在对外部世界的事实掌握的广度和深度上 。
Towards this end, we provide below a sequence of questions to guide your search for the right algorithm for your problem. To use it effectively. The key is working through the answers carefully,掉进自己设置的陷阱,你不但要反问自己这些问题,更重要是仔细回答这些问题;第二部分的问题清单帮助你为你的问题建模 。通过仔细明确的回答“为什么不能”时,而是“不能 。
The key to algorithm design (or any other problem-solving task) is to proceed by asking yourself a sequence of questions to guide your thought process, the most useful person in the room is the one who keeps asking 。kemin:如果问题解决是一种思考过程,那么思考的形式(过程的严谨性?”……如果 你被一个问题掐住了 。
因为引导我们思考前进的方式 除反问本身外,反问的内容也很重; is never ``no,',最好的办法就是先搁一下,换一个问题换一个前进的方向试试,最好把答案写下来 。回答诸如问题“我可以使用这种方式吗?”的 不是一个“不能”就完了? Should you get stuck on the problem, the best thing to do is move onto the next question 。
就比如参加头脑风暴的材料一样 。人大脑的思维功能是硬编码的,人与人之间没有思维规律——质的区别,只是思维的清晰度和 灵敏度——量的差别 。
人与人之间智力的差别更多体现在思维内容的量上. 在末尾我们提供一个反问问题的列表;' not the person who later tells them why. In any group brainstorming session? What if we do that设计一个正确的算法是一件困难的工作,因为它需要创新,从以太真空中发掘出一个解方案来解决问题 。算法设计比对现有的方案进行改良要难得多,因为算法设计的可选择空间太,过多的自由反而成了一种约束 。
This book is designed to make you a better algorithm designer; yet getting it is essential to become a successful designer. 本书的设计目标是让你成为一个更好的算法设计者 。本书第一部分展示有关组合算法的基本原理和基本思想. Strategy represents the quest for the big picture, the framework around which we construct our path to the goal. Tactics are used to win the minor battles we must fight along the way. In problem solving, it is important to check repeatedly whether you are thinking on the right level. If you do not have a global strategy of how you are going to attack your problem, it is pointless to worry about the tactics. 在设计过程中特别重要区分策略和战略的概念 。