Hands-On Data Structures and Algorithms with Rust
上QQ阅读APP看书,第一时间看更新

Downsides

The linked list has some obvious shortcomings:

  • Indexing is inefficient, since every node has to be looked at.
  • Iteration in general involves a lot of jumping around on the heap, which takes more time and makes the operation hard to cache.
  • Reversing a list is very inefficient.

The last point is important, so, commonly, a linked-list implementation will have a link back as well, which makes it a doubly linked list.