更新时间:2023-09-16 23:01:10
由于它的作用就像一个哈希表,你会访问一个元素时有 O(1)
时间由关键
Because it acts like a hash table, you will have O(1)
time when accessing an element by a key.
如果您通过数组循环,自然你就会拥有 O(N)
的时间。
If you are looping through the array, naturally you will have O(n)
time.
如果你有时间,你其实可以看看PHP的实施阵列这里的
If you have time, you can actually check out PHP's implementation of array here