Array vs linked list — what's the trade-off?
The gist
An array stores elements contiguously: O(1) index access and excellent cache locality, but O(n) insertion/removal in the middle because of shifting. A linked list stores nodes with pointers: O(1) insertion/removal when you hold a reference to the node, but O(n) index access and search, plus every node is a separate allocation and a cache miss.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep