Below you will find pages that utilize the taxonomy term “Rust”
Postsread more
Linked List With Rust
Linked lists are part of the most basic data structures in Computer Science. They have several advantages over arrays (Skiena, 2020):
- Overflow never occurs, unless the memory is actually full
- Insertion and deletion are simpler
- With large records, moving pointers is easier and faster
These structures use pointers to connect all the pieces in the list by giving a memory address to each item.
As a beginner in Rust, implementing a singly linked list is an opportunity to learn about dynamic memory and ownership. A crucial concept in dynamic memory is the heap: we don’t know the amount of items in the list, so this structure cannot exist in the stack memory. As each item has at most one pointer referring to it, we have unique ownership.