Why is inserting in the middle of a linked list O(1)?

You are correct, the article considers "Indexing" as a separate operation. So insertion is itself O(1), but getting to that middle node is O(n).


The insertion itself is O(1). Node finding is O(n).