All right? And I'm going to say-- sort of set that stage here, so that-- It turns out that that's probably about the best we can do, or again ends at the length of the list.
我要说的是,这一阶段的集合,我们用最优的方法完成,还是取决于列表的长度,好的,还是回到了我的问题上了。
This lets me have a way of representing things that could be arbitrary in size. And some of these things could be huge, if they're themselves lists.
有些可能很大,如,果他们本身就是列表,那问题来了。
We don't seem to be doing that just yet, certainly not as badly, alright, so at this point in the story I have a sorted list of size 4.
当然现在我们不需要那样做,此时此刻,我已对整个问题中大小为4的列表排好序了。
Well let's see. My fall back is, I could just do linear search, walk down the list one at a time, just comparing those things. OK. So that's sort of my base. But what if I wanted, you know, how do I want to get to that sorted list? All right?
我只能做线性搜索了,一次遍历一遍列表,一个一个比较,但如果我想要,那怎样得到有序的列表呢?,现在的一个问题是,我们排序之前?
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的时候停止分解,那是一个非常简单的对比。
应用推荐