DEV Community

Discussion on: thank u, next: an introduction to linked lists

Collapse
 
dean profile image
dean

The main reason I use linked lists are for queue structures where you frequently need to add to the end or pop the beginning, it's very bad if either of these operations are O(n). Instead you can use a simple singly-linked list.

When using a language like Java though, the LinkedList class isn't that good. The entire point of using a LinkedList over an ArrayList is that you can control certain things to make sure that the list operates as efficiently as possible, but Java's implementation doesn't allow for this.