frontEnd_book icon indicating copy to clipboard operation
frontEnd_book copied to clipboard

数组里面有10万个数据,取第一个元素和第10万个元素的时间相差多少

Open hanyueqiang opened this issue 4 years ago • 0 comments

数组根据索引获取下标值,时间复杂度是O(1),所以第一个跟最后一个元素 时间消耗相同。插入值复杂度O(n) 注意:链表的时间复杂度O(n),插入值的复杂度是O(1)

hanyueqiang avatar Dec 14 '20 02:12 hanyueqiang