- Hands-On Data Structures and Algorithms with Rust
- Claus Matzinger
- 72字
- 2021-07-02 14:11:52
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.