Array vs list vs map0/59 done

Array vs linked list vs hash map

OperationArrayLinked listHash map
Access by indexO(1)O(n)n/a
Search by valueO(n), O(log n) if sortedO(n)O(1) by key
Insert / delete at endO(1) amortizedO(1) with tailO(1)
Insert / delete at front or middleO(n), shiftsO(1) if you hold the nodeO(1)
Memorycontiguous, cache friendlyscattered, a pointer per nodeextra for buckets

Arrays win most real benchmarks because the CPU cache loves contiguous memory. Linked lists win when you hold node references and splice often, as in an LRU cache.