减治法概念

 

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.

 

转载于:https://www.cnblogs.com/qilinart/articles/4982856.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值