And then, when I got- I'm also going to count how many comparisons I do, just so I can see how much work I do here, and then notice what it does.
并能看到算法干了些什么-,然后是如果这个索引,比数组的大小小的话,就意味着还没检索到数组的最后。
If we take item 2, 1 then, well, the index after that will of course be And the available weight will be 3.
如果我们装了2号物品,然后,它之后的索引号当然是,我们还剩下3磅。
Was it particularly high-technology we didn't allow for indexing.
因为没有特别的高科技,我们就没有进行索引。
And so you can really-- the process starts to pick up traction pretty quickly.
这样你就可以-,启动项目,沿着这条索引,迅速地完成整个计划。
It's really a technology initiative that's aimed to index the "dark" web or the hidden web, because according to computer scientists, right now the conditional search engines only index about 1% of the information on the Internet.
这是一项,致力于将暗网,或隐藏网页纳入索引的技术创新,根据计算机科学家的统计,条件式的搜索引擎只将,互联网上1%的信息纳入了索引。
I'm going to set up an index, which is going to tell me where to look, starting at the first part of the list, right?
索引告诉我从哪里开始检索数组,对不对?,然后我会去记录下我做了多少次比较,这样我就能看到这个算法的工作量了?
Right.? I'm going to set up a variable to say, none what's the answer I want to return, is it there or not. Initially it's got that funny value none.
看我要找的答案在不在数组里面,初始化为,然后建立一个索引。
As we've seen systematically in the don't-takes, the only thing that gets changed is the index.
当我们系统的看这些,不应该装的物品时,唯一改变的是索引值。
So that means this node 1 will have an index of 1.
所以这意味着,这个节点索引值将会为。
Well, the bracket notation means you can index into this variable.
好的,这个括号的意思是你可以,索引这个变量。
So that gives me my index.
所以,这就是我的索引号。
So we can have an example, let's look at it.
而键是起到一个索引的作用。
i-1 But with index i minus 1.
但是同时返回的是索引号。
Again I should have said first, index 0, the first one. I can similarly go in and say I'd like all the things between index 2 and index 4. And again, remember what a b c that does. Index 2 says start a 0. 1, 2. So a, b, c.
我还是要说一遍,索引为0的元素,是第一个元素,我可以要求返回索引,2和4之前的所有元素,请记住2,是从0开始的,那么0,1,2对应的是。
Now I seem to be violating my own mantra here by just calling this variable A, but this is reasonable, I much as with four loops when you just call an incrementing variable I, because you just need an index, well, same here.
现在我好像违背了我自己的意愿,我把这个变量叫做A,但这是合理的,就像我们的for循环中,我们把一个增变量叫做,因为我们只要一个索引,这里也一样。
应用推荐