什么是"O(1)访问时间"?意思是? [英] What does "O(1) access time" mean?

查看:316
本文介绍了什么是"O(1)访问时间"?意思是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到"O(1)访问时间"这个术语曾经表示迅速",但是我不明白它的含义.我在同一上下文中看到的另一个术语是"O(n)访问时间".有人可以简单的方式解释这些术语的含义吗?

I have seen this term "O(1) access time" used to mean "quickly" but I don't understand what it means. The other term that I see with it in the same context is "O(n) access time". Could someone please explain in a simple way what these terms mean?

另请参见

  • What is Big O notation? Do you use it?
  • Big-O for Eight Year Olds?

推荐答案

您将要了解复杂性的顺序.

You're going to want to read up on Order of complexity.

http://en.wikipedia.org/wiki/Big_O_notation

简而言之,O(1)表示它花费恒定的时间,例如14纳秒或3分钟,无论集合中的数据量如何.

In short, O(1) means that it takes a constant time, like 14 nanoseconds, or three minutes no matter the amount of data in the set.

O(n)表示它花费的时间与集合的大小成线性关系,因此,两倍大小的集合将花费两倍的时间.您可能不想在其中一个对象中放入一百万个对象.

O(n) means it takes an amount of time linear with the size of the set, so a set twice the size will take twice the time. You probably don't want to put a million objects into one of these.

这篇关于什么是"O(1)访问时间"?意思是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆