排版真的乱到一个 ¥*@#&?
一,Divide-and-Conquer(分治法)
分治法的设计策略包含下列步骤:
- 切割(Divide):一个较大的问题切分成一个或多个小的问题。
- 征服(Conquer;或称为解决solve):解决每一个较小的问题。
除非问题足够小否则使用递归来解决。
- 合并(Combine):如果需要,将所有小问题的解答加以合并(combine),以获得原始问题的解答。
— 需要合并的问题:Merge Sort 归并排序
— 不需要和并的问题:Binary Search 二分搜索
二,Recurrences(递归)
递归是一个等式或不等式,它用函数在较小输入上的值来描述函数。
分治法求解递归式
- Substitution method 替换法
- Iteration method 策略迭代法
- Master method 主项定理
Technicalities
- We neglect certain technical details when we state and solve recurrences. A good example of a detail that is often glossed over is the assumption of integer arguments to functions. Boundary conditions is ignored. Omit floors, ceilings.
- 我们在陈述和解决复发时忽略了某些技术细节。一个经常被忽略的细节的好例子是对函数的整型参数的假设。忽略边界条件。省略下界和上界。
1,替代法(Substitution method)
使用步骤:
- 利用猜测、观察或汇整的方式,找出遞迴方程式的解
- 利用数学归纳法証明此解是正確的
Example:
Subtleties
Avoiding pitfalls
Changing variables
2,Tree Method
算法分析