第二章 Big O notation
来源:互联网 发布:火箭nba 知乎 编辑:程序博客网 时间:2024/06/05 06:38
第二章
Big O notation
计算机的计算过程中,基本上都是一些复杂的计算,数以千计,数以万计或是数以亿计的计算,那么如何计算和总结为让我们更加简单易懂的语言呢,与成绩分层是一个道理,A是好的,B次好等等等等,那么我们就引入了big O notation这个概念。
在这里,我们程序员如果要进行编程,我们不希望计算机花费大量的时间去进行一个运算,对于我们和用户来说,我们要尽全力将big O 弄到最小。
1,2,3,4,5,6,7的是O(1),是属于常数的
n,2n,2n+1,4m+4的是O(n),是属于线性函数
n^2 4n^2+3等等的话就是O(n^2),二次的线性函数
等等
那么,如果一个函数它是以多项式来表示的,那么他的big O notation是什么呢?
给大家一个我们学校的例子,
当我们要看一个多项式的时候,General rule,pick the term that grows the fastest and remove
the constants from it:
the constants from it:
5n + 2log(n) is O(n).
3n^3 +2^n/6 is O(2^n ).
8log(n) + 7n is O(n).
3n^3 +2^n/6 is O(2^n ).
8log(n) + 7n is O(n).
从增长速度最小到速度最快:
loglogn
logn (logarithmic)
sqrt n
n (linear)
n log(n)
n^2 (quadratic)
n^3 (cubic)
...
n^k (polynomial hierarchy)
a^n (exponential hierarchy)
n!
logn (logarithmic)
sqrt n
n (linear)
n log(n)
n^2 (quadratic)
n^3 (cubic)
...
n^k (polynomial hierarchy)
a^n (exponential hierarchy)
n!
以上是big o notation的基础,下一期我会详细的介绍到实例
0 0
- 第二章 Big O notation
- 第二章 Big O notation 进阶课程
- Determining Big O Notation
- big O notation
- 第二章 Big O notation 试题以及讲解 (包会)
- 算法的时间复杂度:Big O notation
- Big O,Big Theta,Big Omega,little o,little omega notation的定义
- 算法的基础知识( Time Complexity & Space Complexity& Big O notation)
- Big O notation大零符合 入门讲解
- n!的近似值 (stirling approximation)与 大O记法(big -O- notation)
- Big "O"
- 算法学习之“Big Oh Notation”
- Big O and little o
- Big-O Cheat Sheet
- Big-O Complexity Chart
- Big O, Big Omega, Big Theta的含义
- 算法度量 Big O, Big Omega, Big Theta
- STL and Big O Cheat Sheet
- NS2 学习笔记—— AODV协议
- iOS 设置控件全局显示样式appearance proxy
- opengl矩阵堆栈的常识
- Linux学习笔记(7)
- shrink_to_fit() demo
- 第二章 Big O notation
- 基于zookeeper、连接池、Failover/LoadBalance等改造Thrift 服务化
- Problem C: 通话记录
- (单片机原理与应用)并行口设计花样流水灯
- os_study01
- Android在非UI线程中显示Toast
- Windows 7安装Eclipse 3.7搭建C/C++开发环境
- (单片机原理与应用)并行口设计数字键盘实验
- hdu 5035 指数概率分布+积分