What are real world examples of when Linked Lists should be used?

leora picture leora · Mar 21, 2009 · Viewed 16.4k times · Source

Another programmer was mentioning that they haven't found a use case for using a linked list data structure in any professional software in his career. I couldn't think of any good examples off the top of my head. He is mostly a C# and Java developer

Can anyone give some examples where this was the correct data structure to solve a particular real world problem?

Related: What is a practical, real world example of the Linked List?

Answer

JaredPar picture JaredPar · Mar 21, 2009

Linked Lists offer several advantages over comparable data structures such as static or dynamically expanding arrays.

  1. LinkedLists dose not require contiguous blocks of memory and therefore can help reduce memory fragmentation
  2. LinkedLists support efficient removal of elements (dynamic arrays usually force a shift in all of the elements).
  3. LinkedLists support efficient addition of elements (dynamic arrays can cause a re-allocation + copy if a particular add exceeds the current capacity)

Any place where these advantages would be significantly valuable to a program (and the disadvantages of a LinkedList were negligible) would be a place to use a LinkedList.