Arraylist LinkedList Hashmap时间复杂度

 

name时间复杂度
ArrayList :根据下标查询 :arr[10] O(1)
ArrayList :根据内容查询 :for循环遍历 O(n)
ArrayList底层是j基于数组实现 linkedList底层是基于 链表实现
LinkedList查询 无论下标还是内容都是 O(1)
JDK7 hashmap根据key查询:没有hash冲突 O(1)
有hashmap冲突 O(n)

总结:直接通过 数组下标 查询:O(1)

linkedList for查询:
在这里插入图片描述

原文地址:https://www.cnblogs.com/shoshana-kong/p/14062505.html