|
|
|
|
|
by fleventynine
1299 days ago
|
|
> Even the most trivial singly linked lists.... Uh, a singly linked list is trivial to implement... struct LinkedListNode<T> {
value: T,
next: Option<Box<LinkedListNode<T>>>,
}
Any data structure where chunks of heap memory are owned by a single pointer (red black trees, singly-linked lists, vectors, deques, circular queues, etc) can be represented easily in safe rust.Implementing a double-linked list is where things get tricky, as the nodes don't have a singular owner. |
|