什么是Master Theorem?
The Master Theorem主要用于快速计算出Recurrence relations(递归算法)运行所需的工作量。
公式如下(常数a > 0, b > 1, d >= 0):


n代表:the size of the current problem (问题规模的大小)
a代表:calls at a level (方法内需要再次调用此方法的次数)
b代表:the size of each subproblem (每个子问题的规模大小)d代表:work at a level (cost of dividing + merging) (将问题分解成子问题的工作量以及将子问题的解合并成原问题的解的工作量)
什么是Recurrence relations?
指在方法之中调用方法,比如:
def binarySearch(arr, low, high, key):
if high &g

本文介绍了Master Theorem在分析递归算法运行时间中的应用,详细讲解了其公式和三个主要案例:二分搜索、多项式乘法及Karatsuba算法。通过Master Theorem,可以计算出算法的工作量并评估效率。

1350

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



