... 【校稿】第四十二篇 Divide and Conquer In 【翻译】第四十二篇 Divide and Conquer In 第三十五篇 Tools and techniques to help ...
基于10个网页-相关网页
In that case, try to divide and conquer. Break the problem into smaller parts you can more easily tackle.
这时候,试着去分解问题再逐一解决,把难题分解成更小的部分,令你解决起来更容易。
Divide and conquer is an excellent strategy to adopt in this stage.
分而治之是这个阶段能采用的一个优秀策略。
Divide-and-conquer is a recursive technique, meaning that it uses some method to split a problem in half, then uses the same method to split those halves in half, and so on.
分治是一种递归算法,就是指利用一种方式把问题一分为二,然后用同样的方法把已分开的问题再一分为二,直到满足最小的解决单元。
OK. Binary search is perhaps the simplest of the divide and conquer algorithms, and what does that mean? It says, in order to solve a problem, cut it down to a smaller problem and try and solve that one.
好了,二分搜索也许是,最简单的分治算法,这意味着什么?,也就是说,为了解决一个问题,把它切割成小的问题,然后再来一个个解决。
Merge sort takes this idea of divide and conquer, and it does the following: it says let's divide the list in half.
归并排序以如下的步骤使用了分治思想:,把列表分成两半:,下面就是分治。
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.
一个分治的例子,注这里,与二分查找所不同的地方,我们肯定是分解了,但是合并的过程还是需要一些工作量的,我会详细说明怎样把它们合并在一起的,当你在考虑设计一个分治算法时,这是你要必须记住的最基本的东西。
应用推荐