So I'm going to solve this by enumerate and check, which is an example of what's called a brute-force algorithm.
你懂的,所以我得靠列举和检验来解决这个问题,这就是我们说的穷举算法。
So it's definitely also like a touristic attraction just to check out what the people are doing as well.
看看那里的人在干什么也其实就是一个景点了。
Now, what did I want to do? I wanted to check membership. I want to do search. Well that's simple. Given that representation and some value, I just say gee is it there?
现在,我需要做什么?,我要做成员检查,我要做查找,这就很简单了,给了即定的表示和一些值,我只需要说喂在那儿吗?
So again, when we check these, what we want to see is that our z effective falls in between the two extreme cases that we could envision for shielding.
所以当我们再一次检查这些时,我们想看到的是,有效电荷量处于两种极端案例中,这两种极端案例。
So conceptually the key difference here, besides the syntax looking slightly different, it just means that if you want a chunk of code to execute no matter what initially, ; you can use the do while loop; if you want to check a condition first, you can use the while loop.
所以概念上,则关键的区别是,除了语法看起来有点不同,它的意思是如果你想要一段代码,最初无论如何都要执行,你就可以用do,while循环;,如果你想要先检查条件,你可以用while循环。
The only place q1 appears here is here, so when I differentiate again I'm going to get -2b and sure enough that's negative, which is what I wanted to know, just to check that when I'm finding this thing, I'm finding a maximum and not a minimum.
只有这一处有q1,因此二阶导数是-2b,它肯定是个负数了,这正是我们想得到的结果,这就验证了我们刚才得出的,是最大值而不是最小值
And just to look ahead a little bit, you could easily imagine that I might want to not just put a statement in there, what the specs are, I might want to put some constraints. Some specific things to check for, to make sure that you're calling the code right.
这不仅是抽象的概念还有规范的概念,我们再往前看看,你可以简单的想象得到,我不仅仅是想在这里加一个声明,这些规范说明中我还想加一些约束,我们要注意一些特殊的事情。
There's the base case. If it's longer than one, what do I want to do? Well I'd like to check the two end points to see are they the same character? And if they are, then oh, I just need to know is everything else in the middle a palindrome?
如果只有一个元素也是回文,这是基本事件,如果比一个长的话那么我应该怎么做?,我将会查看两头是否相同?,如果是的,我只要知道中间剩下的部分是不是回文即可?
应用推荐