zoukankan      html  css  js  c++  java
  • 算法分析之函数渐近分析

    首要原则,三点:

    #1 最坏的情况分析。"worst – case analysis" : our running time bound holds for every input of length n.

    BONUS : worst case usually easier to analyze.

    #2 不关心常数。低阶项。Won't pay much attention to constant factors, lower-order terms

    #3 渐近分析。Asymptotic Analysis: focus on running time for large input sizes n

    Justification: Only big problems are interesting!

    渐近分析。Asymptotic Analysis

    上图即原则#2.

    Example: Equate 6n log2(n) + 6 with just n log n.

    Terminology: Running time is O (n log n) ["big-Oh" of n log n]

    where n = input size (e.g. length of input array).

    Examples:

    Loops:O (n)    Two Nested Loops:O (n^2)

    Big-O-notation

    O-notation is an asymptotic upper bound.

    大O里的内容表示函数渐近上界。

    Basic Examples:

    #1:    

    #2:    

    Omega-notation

    Ω-notation provides an asymptotic lower bound.

    Omega里的内容表示函数渐近下界。

    Theta-notation

    We say that g(n) is an asymptotically tight bound for f (n).

    Theta里的内容取不同的两个系数可表示函数渐近上、下界。

    看三者关系:

    Little o-notation

    We use o-notation to denote an upper bound that is not asymptotically tight.

    小o表示非渐近紧确的上界。而大O可能是也可能不是渐近紧确的。

    而上面例子,小o换成大O都成立。

    小o就是函数极限的定义符号。

    w-notation

    小w表示非渐近紧确的下界。和小o定义相反。因此:

    Examples

    #1

    #2

    #3


    ANNOUNCEMENTS:
    DO NOT USE THE CONTENTS OF THIS BOLG FOR COMMERCIAL PURPOSE, AND I USE THE CONTENTS FORM INFERENCES JUST FOR STUY.
    THIS BOLG IS FORM: http://www.cnblogs.com/JayZen/p/4073235.html 


    Referances

    Course: Algorithms: Design and Analysis, Part 1 by Tim Roughgarden at Stanford from Coursera

    《Introduction to Algorithms》

    本人硕士在读,学习方向:机器学习,数据、图像处理
  • 相关阅读:
    Dispose() C# 优化内存
    C#对图片文件的压缩、裁剪操作初探
    C#如何调用COM
    rtf格式的一些说明,转载的
    IStream 接口
    NET RichTextBox控件如何可以插入图像
    AutoCAD如何打印
    AutoCAD如何编辑块,打散块
    AutoCAD菜单加载失败 找不到文件mnc 怎么办
    AE After Effect 渲染如何输出设置
  • 原文地址:https://www.cnblogs.com/JayZen/p/4073235.html
Copyright © 2011-2022 走看看