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》

    本人硕士在读,学习方向:机器学习,数据、图像处理
  • 相关阅读:
    iOS开发---业务逻辑
    iOS 蓝牙功能 bluetooth
    iOS 企业版 安装失败 原因
    iOS 生命周期 -init、viewDidLoad、viewWillAppear、viewDidAppear、viewWillDisappear、viewDidDisappear 区别和用途
    iOS 7 修改默认布局从status bar 底部开始
    企业打包时不能安装原因
    UISegmentedControl 功能简单 分析
    ios 推送 证书配置
    ios 获取手机设备信息
    创建quickstart报错
  • 原文地址:https://www.cnblogs.com/JayZen/p/4073235.html
Copyright © 2011-2022 走看看