final 1

1. final重点

divide and conquer; FFT; Greedy; dynamic peogramming; max flow

2. 3 notations

1) big O notation

f(n) = O(g(n)) is an abbreviation for :"There exist positive constants c and n0 such that 0≤f(n)≤cg(n) for all n≥n0"

上限

2) Omega

f(n)=Ω(g(n)) is an abbreviation for :"There exist positive constants c and n0 such that 0≤cg(n)≤f(n) for all n≥n0"

等价于g(n)=O(f(n))

下限

3) Theta

f(n)=Θ(g(n)) if and only if f(n)=O(g(n)) and f(n)=Ω(g(n)); thus, f(n) and g(n) have the same asymptotic growth rate

相等

3. Master theorem

 

4. divide and conquer

将一个难以直接解决的大问题,分割成一些规模较小的相同问题,分而治之

步骤:1)将原问题分解成若干个规模较小,相互独立,与原问题形式相同的子问题

2)递归的解决各个子问题

3)将各个子问题的解合并为原问题的解

可以类比为数学归纳法,找到解决本问题的求解方程公式,然后根据方程公式设计递归程序

例题可以理解为,画一个田字格将图案分成4份,本来只有一个有洞,现在在中间放一个domino,变成四个部分均有一个洞,继而可以递归解决

 

posted on 2020-08-17 10:13  Eleni  阅读(150)  评论(0编辑  收藏  举报

导航