Arrays vs Linked Lists: Why the Textbook Winner Loses on Real Hardware
DEV Community
Arrays vs Linked Lists: Why the Textbook Winner Loses on Real Hardware
The textbook says a linked list inserts in O(1) and an array inserts in O(n), so the linked list should win. On real hardware the array wins almost every time — and the reason is not in the code, it's in where the data physically sits. Measured: the
0 comments
No comments yet.