OK, and you can see that this thing ought to unwrap, it's going to keep extending out those multiplications until gets down to the base case, going to collapse them all together.
好,你可以看到这种方法,是怎么解决的,他一层层的将乘法展开一直到最底层,然后将他们一起乘起来。
And it's just gathering together the multiplications while counting down the exponent. And you can see it when we get down to the end test here, we're going to pop out of there and we're going to return the answer.
这个方法就是通过乘法,来一个一个的减小指数,可以看到,最后面的结果测试,我们会在这里退出,然后返回答案。
Just as in grade school when you're doing division and multiplication, you do it from left to right in terms of order of operations.
正像是在小学你做除法和乘法的时候,你毫不含糊地从左到右,按顺序做运算。
One of the first principles of probability theory is called the multiplication rule.
概率论的最基本的原则,有一条叫乘法原理
You still could do your multiplication tables.
你还是能够做乘法的。
So I'm going to build something that's going to do iterative exponentiation.
首先我会写一个,迭代乘法的过程。
STUDENT: Standard order of operations, I guess take the multiplication first, and add the three.
学生:标准运算符的顺序,我猜是先做乘法,然后再去加3。
Because this is overloading that multiplication operator with two different tasks.
因为这会造成使得乘法操作符,对两种不同的任务造成重载。
I can't multiply while I'm standing up.
我站着的时候就算不清乘法了
They're inside that loop-I've got the wrong glasses so I'm going to have to squint- and we've got one test which is a comparison we've got another test which is a multiplication-- sorry, not a test, we've got - another step which is a multiplication- and another step that is a subtraction.
他们在循环里面呢,我带错眼镜了所以不得不斜视-,然后我们这里有一个比较的测试,还有一个乘法的测试,-对不起,不是测试,是另外一个乘法的步骤-,还有一个减法的步骤。
I've got one test, I've got a subtraction, I've got a multiplication, that's three steps, plus whatever number of steps it takes to solve a problem of size b minus 1.
我进行了一次比较,一次减法,一次乘法,一共是三个步骤,再加上t的步骤数。
应用推荐