1、减治法的定义?
答:The decrease-and-conquer technique is based on exploring the relationship between a solution to a given instance of a problem and a solution to a smaller instance or of the same problem.
2、减法法的三种类型是什么,分别举例说明?
答:there are three major variations of decrease-and-conquer:
(1)Decrease by a constant:
the size of the problem is reduced by the same constant on each iteration/recursion of the algorithm.
For example :
Insertion sort (插入排序)、DFS(有向图的深度优先遍历)、BFS(有向图的广度优先遍历)
(2)Decrease by a constant factor:
the size of the problem is reduced by the same constant factor on each iteration/recursion of the algorithm.
For example :
Binary search (折半查找算法)、Fake-coin problems(假币问题)
(3)Variable-size decrease:
the size reduction pattern varies from one iteration of an algorithm to another.
For example :
Euclid’s algorithm(欧几里得求最大公约数算法)
3、减治法和分治法的区别是什么,可举例说明?
答:The divide-and-conquer has three steps: divide,conquer and combine.It must deal with each problems,and combine them finally.But the decrease-and-conquer technique is based on exploring the relationship between a solution to a given instance of a problem and a solution to a smaller instance or of the same problem. It do not combine them and do not solve each of them.
For example: compute a n
The divide-and-conquer :compute a n=a n/2 * a n/2 if a>1;
=a if a=1.
The decrease-and-conquer :compute a n=(a n/2 )*2 if n is even and positive;
= (a(n-1)/2 ) 2 * a if n is odd and > 1;
=a if a=1.