DEV Community

Discussion on: Data Structures & Algorithms in JavaScript(Single Linked List) Part 1

Collapse
 
de0xyrib0se profile image
de0xyrib0se • Edited

Your insert calls this.getElementAt to get the previous, that is not O(1).

That trailing pointer can make the difference between serving a response and not serving anything in a production setting ;) Every cycle counts, even on 32 cores and 128GB of RAM...