O(N) 是什么意思 [英] what does O(N) mean
问题描述
可能重复:
什么是大 O 表示法?你会用吗?
大家好,
相当基本的可伸缩性符号问题.
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)
上面的符号是指什么?
推荐答案
评论指的是 Big-O 表示法.
The comment was referring to the Big-O Notation.
简单地说:
- O(1) 表示在恒定时间内 -与项目数量无关.
- O(N) 表示与项目数.
- O(log N) 表示时间与日志(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 是一个常数乘数
f()是一个依赖于N的函数
f() is a function that depends on N
这篇关于O(N) 是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!