- UID
- 1286936
- 在线时间
- 小时
- 注册时间
- 2017-6-27
- 最后登录
- 1970-1-1
- 主题
- 帖子
- 性别
- 保密
|
地板
楼主 |
发表于 2021-10-23 14:07:27
|
只看该作者
make a global plan for how this work. figure out how to solve each of these subtasks. Later on, this is sort of a general idea with algorithms, when you're developing them.What you don't want to do is write line one of the algorithm and then write line two of the algorithm and thenThree of the algorithm,
but you want to do is write the algorithm in chunks and plan out what the chunks are going to be and then go into each chunk and write that in more detail and so on.
So, develop your algorithms sort of breadth first rather than depth first, just the way that we recommend doing with fruits, write out the cases then the case.
The case delimiters分隔符 before you go into each case and fill in the details.
And the idea is that this is a smaller instance of exactly the same problem. So, the question is how do I know that this works.The same thing is true here.
I need to make sure that the problems that I'm solving by these recursive calls, really are smaller instances of exactly the same problem
But as a general rule, it's really only going to get confusing if you try to unpack that it's really important to think when you're designing the algorithm recursion is magic. As long as you follow the rules. Smaller instance of exactly the same problem. It'll work out fine. When we're generally when we're designing algorithms, we don't just want to know that we've solved the problem correctly.
|
|