`
leonzhx
  • 浏览: 785977 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
阅读更多

1. Assumption:

    a)  Base Case : T(n) <= a constant for all sufficiently small n

    b)  For all sufficiently large n : T(n) <= a T(n/b) + O(n^d) , where:

         i)  a = number of recursive calls on subproblems ( >= 1)

         ii)  b = input size shrinkage factor ( > 1)

         iii)  d = exponent in running time of "combine step" (>= 0)

         iv)  a, b, d are independent of n

 

2.  Master Method :

        if T(n) <= aT(n/b) + O(n^d)

 

                     O (n^d log n )  ,   a = b^d

        T(n) =   O (n^d)            ,   a < b^d

                     O (n^ (logb a) )    ,   a > b^d

 

3.  For recursion tree, at each level j=0, 1, 2, ..., logb n  , there are a^j subproblems each of size n/b^j.

     Total work at level j ( ignore work in recursive call ) <= a^j X c (n/b^j)^d = cn^d X (a/b^d)^j

      a = rate of subproblem proliferation ( RSP)

      b = rate of work shrinkage (RWS )

 

      i)  If RSP < RWS, then the amount of work is decreasing with the recursion level j.

           ==> most work at root

      ii)  If RSP > RWS, then the amount of work is increasing with the recursion level j.

           ==> most work at leaves

      iii)  If RSP and RWS are equal, then the amount of work is the same at every recursion level j.

           ==> same amount of work each level

 

      Total work <= cn^d X sum ( (a/b^d)^j ) (j=1~logb n)

 

4.  If a = b^d , then (a/b^d) ^j =1 , so the total work <= cn^d X (logb n +1 ) = O(n^d log n )

            ( logb n = logk n / logk b = 1/logk b X logk n , so b is not important for logb n , it can be any value , only a constant factor difference)

     let r = a/b^d , 1 + r + r^2 + r^3 + ... + r^k = r^(k+1) -1 / r - 1

    if r < 1 is constant , 1 + r + r^2 + ... + r^k <= 1/ (1-r)  = a constant (1st item of sum dominates)

     (i.e. 1/2 + 1/4 + 1/8 + ... <= 1/2 * 2 )

     so the total work <= cn^d X 1/(1-r) = O (n^d)

    if r > 1 is constant , 1 + r + r^2 + ... + r^k <= r^k ( 1+ 1/r-1)  ( last item of sum dominates)

     so the total work <= cn^d X logb n X r^logb n  = O ( a ^ logb n ) ( note : (1/b^d) ^logb n = 1/n^d) = O(n^logb a)

     actually a^logb n is the number of leaves of the recursion tree.

  • 大小: 13.5 KB
分享到:
评论

相关推荐

    dex-method-counts-master.zip

    "dex-method-counts-master.zip" 文件提供了一种工具,用于查询Java或Kotlin编译后的.jar或安卓APK中的方法数量。这个工具对于优化应用、避免Dalvik VM(或ART)的65536方法限制,以及理解代码复杂性都是十分有用的...

    Lecture3-compressed.pdf

    根据提供的文档内容,我们可以了解到课程中讲授的几个关键知识点,主要包括递归关系(Recurrence Relations)的求解方法、主方法(Master Method)以及子stitution Method)。 递归关系是递归算法分析中的一个核心...

    气相色谱~串联质谱仪操作规范流程.doc

    - 在Method Development中建立进样方法和数据处理方法,创建batch,选择Master Method,提交运行样本。 5. **数据分析与报告** - 在Analysis下的Data Review查看数据结果,Report Review查看报告结果。 6. **...

    [算法导论].[Introduction.to.Algorithms].Third Edition

    还介绍了最大子数组问题(Maximum-subarray problem)和相应的递归关系式求解方法,包括替换法(Substitution method)、递归树方法(Recursion-tree method)以及主定理(Master method)的证明。 为了提高算法的...

    MIT Introduction to Algorithms FINAL EXAM SOLUTION

    - 利用主定理(Master Method)来求解递归方程。主定理是解决递归关系式的一种高效方法,通常用于涉及分治法的算法分析。例如,方程 T(n)=2T(n/8)+∈n 的解答用主定理的Case2得到T(n) = Θ(n^(1/3)lg(n))。 - 对于...

    算法导论 英文版第三版 - Introduction to Algorithm

    - 介绍了分治法的基本概念,并探讨了递归式解决的方法,如替代法(Substitution method)、递归树法(Recursion-tree method)、主方法(Master method)以及主定理的证明(Proof of the master theorem)。...

    Introduction to Algorithms 3E_Thomas H. Cormen

    并介绍了递归式求解(Recurrences)的三种主要方法:代换法(Substitution Method)、递归树法(Recursion-Tree Method)和主方法(Master Method)。主方法在分治算法分析中尤为重要,它是解决特定递归式的一种系统...

    算法导论第三版(英文)

    - 递归关系的解法:包括替代方法(Substitution method)、递归树方法(Recursion-tree method)和主定理(Master method)等,用于解决递归关系式,它们是分析递归算法时间复杂度的关键。 - 概率分析和随机算法:...

    利用dex-method-counts-master查看app方法数量

    "利用dex-method-counts-master查看app方法数量"这个主题主要涉及到Android应用的Dalvik Executable (DEX) 文件、方法计数、以及如何通过第三方工具进行分析。 首先,了解DEX文件。在Android系统中,Java源代码被...

    算法导论(第三版)

    书中通过最大子数组问题(Maximum-Subarray Problem)来说明分治法的应用,并介绍了递归式求解的方法,比如递归树方法(Recursion-Tree Method)和主方法(Master Method)等。 此外,书中还探讨了概率分析和随机化...

    解决算法分析中递归问题的方法

    本文将详细介绍三种解决递归问题的方法:**替换法(Substitution Method)**、**迭代法(Iteration Method 或 Recursion Tree Method)**以及**主定理(Master Method)**。 #### 1. 替换法(Substitution Method)...

    算法导论英文版

    4.3 The master method 73 4.4 Proof of the master theorem 76 5 Probabilistic Analysis and Randomized Algorithms 5.l The hiring problem 91 5.2 Indicator random variables 94 5.3 Randomized algorithms 99 ...

Global site tag (gtag.js) - Google Analytics