栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Java Collections Framework实现的Big-O摘要?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Java Collections Framework实现的Big-O摘要?

我可能很快就会教“ Java速成课程”。虽然可以很安全地假设受众成员知道Big-O表示法,但是假设他们将知道各种集合实现上的各种操作的顺序可能是不安全的。

我可能会花一些时间自己生成一个摘要矩阵,但是如果它已经存在于公共领域中的某个地方,我肯定会重用它(当然要有适当的信誉)。

有人有指针吗?列出实现:

get  add  contains next remove(0) iterator.removeArrayList  O(1) O(1) O(n)     O(1) O(n)      O(n)linkedList O(n) O(1) O(n)     O(1) O(1)      O(1)CopyOnWrite-ArrayList O(1) O(n) O(n)     O(1) O(n)      O(n)

设置实现:

add      contains next     notesHashSet    O(1)     O(1)     O(h/n)   h is the table capacitylinkedHashSet         O(1)     O(1)     O(1) CopyonWriteArraySet   O(n)     O(n)     O(1) EnumSet    O(1)     O(1)     O(1) TreeSet    O(log n) O(log n) O(log n)ConcurrentSkipListSet O(log n) O(log n) O(1)

地图实现:

get      containsKey next     NotesHashMap    O(1)     O(1)        O(h/n)   h is the table capacitylinkedHashMap         O(1)     O(1)        O(1) IdentityHashMap       O(1)     O(1)        O(h/n)   h is the table capacity EnumMap    O(1)     O(1)        O(1) TreeMap    O(log n) O(log n)    O(log n) ConcurrentHashMap     O(1)     O(1)        O(h/n)   h is the table capacity ConcurrentSkipListMap O(log n) O(log n)    O(1)

队列实现:

offer    peek poll     sizePriorityQueue         O(log n) O(1) O(log n) O(1)ConcurrentlinkedQueue O(1)     O(1) O(1)     O(n)ArrayBlockingQueue    O(1)     O(1) O(1)     O(1)linkedBlockingQueue   O(1)     O(1) O(1)     O(1)PriorityBlockingQueue O(log n) O(1) O(log n) O(1)DelayQueue O(log n) O(1) O(log n) O(1)linkedList O(1)     O(1) O(1)     O(1)ArrayDeque O(1)     O(1) O(1)     O(1)linkedBlockingDeque   O(1)     O(1) O(1)     O(1)


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/431973.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号