Inserting or deleting in a linked list costs O(1) once you hold the right node. You rewire a pointer or two and you are done. Nothing else moves, and the rest of the list stays where it sat.
An array behaves differently. To insert or delete in the middle, you must shift every later element over one slot. That shift costs O(n). Only changes at the very end avoid it.
The catch is reaching the node. The linked list is O(1) only after you get there, and finding it first still costs O(n) hops. Arrays trade cheap access for expensive reshaping, and linked lists do the reverse.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
The diagram below the answer is the concept . Jump to it ↓