减治法Decrease and Conquer
*Exploring the relationship between a solution to a given instance of (e.g., P(n) )a problem and a solution to a smaller instance (e.g., P(n/2) or P(n-1) )of the same problem.
*Use top down(recursive) or bottom up (iterative) to solve the problem.
*Use top down(recursive) or bottom up (iterative) to solve the problem.
减治法举例Examples of Decrease and Conquer
Decrease by a constant:the size of the problem is reduced by the same constant on each iteration/recursion of the algorithm.
减去一个常量
Insertion sort
Graph search algorithms:
DFS
BFS
Algorithms for generating permutations, subsets
Insertion sort
Graph search algorithms:
DFS
BFS
Algorithms for generating permutations, subsets
Decrease by a constant factor:the size of the problem is reduced by the same constant factor on each iteration/recursion of the algorithm.
减去一个常量因子
Binary search
Binary search

本文探讨了如何使用减治法(Decrease and Conquer)解决假币问题。通过算法设计与分析,包括减半和减n/3两种策略,详细介绍了如何找到n枚硬币中的一枚假币。此外,还对未知假币重量方向和处理多个假币的情况进行了扩展讨论。
&spm=1001.2101.3001.5002&articleId=46733053&d=1&t=3&u=0ce53b84940940d486869630fd289c5f)
676

被折叠的 条评论
为什么被折叠?



