So, let's do a little sanity check now and let's try to demonstrate as much I now claim I'm going to capitalize the copy of the string I just made.
多以,让我们做一个检查,然后做一个演示,现在我声称,我要利用那个字符串的拷贝。
And when I'm done with the whole thing, before I end the increment of the variable, you know, when I'm done, I'm just not returning anything out.
在循环外面初始化它,然后做一个终结测试,然后在循环内部有一个指令集,在这个例子中,就是对余数做检查,然后显示信息,当我完成了整个循环。
It would definitely be wrong if we were doing this because little sanity check if you just got the single one it means what instead?
如果我们这样做就是错误的,一个小检查,如果你用单个“=“,是什么意思?
So that's just a little bit of a check for yourself, and it should make sense because what you're doing is you're calculating the difference between energy levels, so you just need to flip around which you put first to end up with a positive number here, and that's a little bit of a check that you can do what yourself.
所以你们总要确保括号,离得这项是正的,这是你们自己,可以做的检查,这事很有道理的,因为你们做的是计算能量差,所以你需要调整顺序来保证一个正数,这是你们自己可以做的检查。
First, I'm going to do a sanity check strlen so we've used string length, strlen, before.
首先,我先做一个检查,我们以前使用过字符串长度函数。
So, I have to check for that, but nine times out of ten there's not going to be a problem so now let's do this.
所以,我需要做一个检查,但是通过十有八九,这不会出现问题,现在我这样处理。
So I actually want to have type checking as much as I can early on.
因此我会在尽可能早的地方去,做一个类型检查。
So I have a little sanity check now.
我们现在做了一个明智的检查。
So let's do a little sanity check.
让我们做一个明智的检查。
We'll use more sophisticated tools before long, but let's do a little sanity check.
我们不久后将用更多的复杂的工具,但是让我们做一个明智的检查。
So now a sanity check.
现在做一个检查。
So a little sanity check.
做一个检查。
I then do a sanity check.
然后我做一个检查。
But that merging process only takes N steps, N*log N so that's N times log of N. Now, it's a little tricky to reason through this perhaps the first time, let's just take a very simple example and see if we can do a little sanity check here.
但这个合并过程只需要N步,所以时间复杂度是,第一次对此进行推论可能会有点儿棘手,我们举一个简单的例子,看看我们能否做一些完整性的检查。
I'm going to give a name to that. And what you see there is I'm going to call divisors initially an empty tuple, something has nothing in it. Right here. And then I'm going to run through the same loop as before, going through this set of things, doing the check.
你们可以看到这里,我初始化一个空的元组,名为divisiors,这里,然后我会去运行,跟以前一样的循环,遍历这个集合内的东西,然后做检查,现在我要做的是,每次我找到了一个除数我要把它收集起来。
应用推荐