sajad torkamani

What is it?

An ordered list of items.

const names = ['Jim', 'Bob', 'Alice']

Big O

  • Access: O(1)
  • Insertion
    • Insertion at the end: O(1)
    • Insertion at the beginning: O(n) – We have to re-index all the other elements in the existing array.
  • Removal
    • Removal at the end: O(1)
    • Removal at the beginning: O(n) – We have to re-index all the other elements in the existing array.
  • Searching: O(n)

When to use?

  • When you need the items to be ordered.
  • You need fast insertion and access.