O(N)是什么意思 [英] what does O(N) mean
问题描述
可能重复:
什么是Big O符号?您使用它吗?
Possible Duplicate:
What is Big O notation? Do you use it?
大家好,
相当基本的可扩展性表示法问题.
fairly basic scalability notation question.
我最近收到一篇关于我的python有序列表含义的帖子的评论 但请注意,插入的'有序集'实现为O(N)"
I recently recieved a comment on a post that my python ordered-list implimentation "but beware that your 'ordered set' implementation is O(N) for insertions"
很高兴知道,但是我不确定这意味着什么.
Which is great to know, but I'm not sure what this means.
我看过诸如n(o)o(N),N(o-1)或N(o * o)之类的符号
I've seen notation such as n(o) o(N), N(o-1) or N(o*o)
以上表示法指的是什么?
what does the above notation refer to?
推荐答案
该评论是指 Big- O 表示法.
简而言之:
- O(1)表示恒定时间- 与物品的数量无关. O(N)表示与 项目数.
- O(log N)表示与以下时间成正比的时间 log(N)
- O(1) means in constant time - independent of the number of items.
- O(N) means in proportion to the number of items.
- O(log N) means a time proportional to log(N)
基本上任何'O'表示操作将花费时间,最长为k * f(N)
哪里:
Basically any 'O' notation means an operation will take time up to a maximum of k*f(N)
where:
k是一个常数倍数
k is a constant multiplier
f()是一个依赖N的函数
f() is a function that depends on N
这篇关于O(N)是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!