Alright, so we can implement any number of algorithms using this thing because the basic mechanism I have here is a comparator.
好了,利用它我们可以实现,很多种算法,因为在此我用到的基本原理是一个比较器。
The message I'm trying to get to here, because I'm running you right up against time, is I have to be careful about what's a primitive step.
我想说的事情是,因为我正在跟大家讲算法时间复杂度,我们需要注意一个基本步骤的定义,如果我可以假设。
Notice here that it's different than the binary search case. We're certainly dividing down, but the combination now actually takes some work. I'll have to actually figure out how to put them back together. And that's a general thing you want to keep in mind when you're thinking about designing a divide and conquer kind of algorithm.
一个分治的例子,注这里,与二分查找所不同的地方,我们肯定是分解了,但是合并的过程还是需要一些工作量的,我会详细说明怎样把它们合并在一起的,当你在考虑设计一个分治算法时,这是你要必须记住的最基本的东西。
应用推荐