Having done that, it goes back up and picks the second sub-list, which came from there. It's a down to base case, merges it.
就是从那里得来的,完成这些后,回到上一步。
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.
好,你可以看到这种方法,是怎么解决的,他一层层的将乘法展开一直到最底层,然后将他们一起乘起来。
If you have this so-called base case, can we actually get to a definitive answer eventually?
如果有了这个所谓的基本条件,那我们最终,能得到一个明确的答案吗?
In this case, to optimize for the best of the whole community and the whole user base and over the long term and that's important too, your long over short term.
在这个前提下,去寻求整个社会,以及所有用户的长远利益的最大化,这十分重要,我们寻求长期利益,而非眼前利益。
it's looking first to see am I in the base case, which I'm done. If I'm not I'm just going to reduce this to a smaller computation.
注意这个计算是干什么的,它先判断我是否属于基础事件,这个我已经做过了。
And as long as that smaller computation reduces to another smaller computation, eventually I ought to get to the place where I'm down in that base case.
如果我不属于基础事件,那么我需要把它简化为更简单的计算,随着计算的不断简化,最终我能分解成基础事件。
But I want to stress again, as long as I do the base case right and my inductive or recursive step reduces it to a smaller version of the same problem, the code will in fact converge and give me out an answer.
就开心的去做吧,但是我想再次强调,只要基础事件处理正确而我的递归,或递推步骤能把它简化为更简单的同类问题,那么这段代码就可以收敛。
We call that a base case. It's basically the simplest possible solution to the problem.
我们说这是一个基础案例,这是这个问题最简单的解决方案。
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?
如果只有一个元素也是回文,这是基本事件,如果比一个长的话那么我应该怎么做?,我将会查看两头是否相同?,如果是的,我只要知道中间剩下的部分是不是回文即可?
I need a so-called base case even in my analysis here.
在分析过程中我需要一个所谓的基本条件。
And the code over here says, OK gee, if I'm in the base case do something.
如果我属于基础事件就进行一些操作,而我不是,所以往下看这儿。
The second question I want to ask is what's the base case? When do I get down to a problem that's small enough that it's basically trivial to solve? Here it was lists of size one. I could have stopped at lists of size two right. That's an easy comparison.
第二个问题是什么是基础条件?,我要将问题分解到何时才使得问题,小到可以解决的基本问题?,这里是当列表的长度为1有时候,我也可以在长度为2的时候停止分解,那是一个非常简单的对比。
So that's why that base case rule was so important.
这就是为什么基本条件是如此重要。
It says check to see if I'm in that base case.
这段代码是检查目前是否是最基本的情况。
This is our little sanity check, the base case.
这是合法性检查,是基本条件。
When this gets down to t of 1, I'm in the base case.
当问题缩小到t的时候,就是最基本的情况了。
Yeah. You're jumping slightly ahead of me, but basically, I'm done when this is equal to 1 right? Because I get down to the base case, so I'm done when b u is over 2 to the k is equal to 1, and you're absolutely right, that's when k is log base 2 of b.
因为这就是最基本的情况了,因此当b/2的k次方等于1的时候就停止了1,你说的太对了,就是k等于b的以2为底的对数的时候,你们都坐的挺靠后的啊,我不知道是不是我讲的不太明白?
I've got to test to see if I'm in the base case, and if I'm not, then I need to move a tower of size n minus 1, I need to move a tower of size 1, and I need to move a second-sorry about that a second tower of size n minus 1.
首先我看看我是不是在最基本的情况,如果不是的话,我得先做一个N-1个,圆盘的移动,移动一个圆盘,然后再做一次N-1个圆盘的移动。
At that point we're in the base case and we can unwrap this computation.
在这一步我们就是属于基础事件了,也就是说我们可以打开这个计算了。
When do I get down to the base case?
哦对,你又说到我前头去了?
It says, if I am in the base case, if b is equal to 1, the answer is just a.
首先解决基本的,如果b等于1的话,那么答案就是a了。
应用推荐