2.5 O-Notation

The "O" is for order,as in "Binary search is O(logn);it takes on the order of logn steps to search an array of n items. "
The notation O (f(n)) means that once n gets large ,the running time is proportional to at most f(n), for example , O(n2) or O(nlogn).

Notation Name Example
O(1) constant array index
O(logn) logarithmic binary search
O(n) linear string comparison
O(nlogn) nlogn quick sort
O(n2) quadratic simple sorting methods
O(n3) cubic matrix multiplication
O(2n) exponential set partitioning
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 人为什么要结婚 人为什么要生孩子 因为其他人都这样 因为不结婚就是怪胎 因为世俗 ... 1 我和好友L一起出去逛...
    大鱼禾阅读 719评论 0 0
  • 卡尔·桑德堡屠岸(译) 雾来了——蹑着猫的细步。 它静静地弓腰蹲着俯瞰港湾和城市再向前走去。 Fog The fo...
    粉笔头阅读 542评论 0 3
  • 懵懵懂懂的年少时喜欢陈奕迅 认认真真青春时毫无固定 清清楚楚走过后喜欢上刘若英 偶尔也想来一首民谣一首摇滚 懂得东...
    芥末味十足阅读 195评论 0 0