So if you think about the way something like, say, Mapquest works, and last week in recitation you looked at the fact that shortest path is exponential.
所以如果你想想电子地图,还有上周学的列举法,你就会发现一般最简单的方法,都是指数递增的。
So this plus plus is sort of shorthand notation for incrementation. So just add 1 to this variable's value, so now socks on feet is of course 1 and so next.
那么这个++符号是递增排序的,所以仅仅是对这个变量加一,现在袜子在脚上是一,那么下一个也是这样。
Electrons will occupy orbitals in order of ascending energy, occupying the lowest energy first and up.
电子是按其能量递增顺序,排布在轨道上的,首先占满第一级,即最低能级。
We're checking the end test and incrementing, actually I was going to, I commented that out for a reason you'll see in a second, but I, normally I would keep this on, which would let me, at each step, see what it's doing. If I ran this, it would print out each step. Which is helping me make sure that it's incrementing the right way.
对不对?进行终结测试然后递增,实际上我要,因为某些你们,马上要明白的原因我把这里注释了,但是我通常会一直这么做,这样能让我看到每一步都做了什么,如果我运行这个程序,它会在每一步都,进行显示,这能帮助我让我确信程序是,在以正确的方式递增。
And in fact, they'll go up in intervals of 5.
事实上,会以5%的差额递增
OK. So now you've seen two simple examples.
在我不再递增变量之前,你知道的。
Basic idea, before I even look at the code, is pretty simple. If I've got a list that is sorted, in let's call it, just in increasing order, and I haven't said what's in the list, could be numbers, could be other things, for now, we're going to just assume they're integers.
我们可以说基本的思想是很简单的,如果我有一个排好序的数组,让我们认为这个数组是递增的吧,我并没说数组里元素是什么,可能是数字,也可能是其他的东西,现在我们假设是integer类型的数字吧,最简单的方式就是这么做了:
应用推荐