ECE 522 | Software Construction, Verification and Evolution
Assignment 4: Lifetimes in Rust
Linked List
A linked list is a linear data structure in which each element is a separate object. Every element in the list
consists of two items:
- The data of this element.
- A reference to the next node.
The last node has a reference to an empty node. The entry point into a linked list is called the head of
the list. It should be noted that head is not a separate node, but the reference to the first node. If the list
is empty, then the head is an empty list.
A linked list is a dynamic data structure. The number of nodes in a list is not fixed and can grow and
shrink on demand. Any application has to deal with an unknown number of objects within a linked list.
Source code: linked_list.zip
Question 1: Given the following implementation of a linked list in main.rs in the attached source code:
pub enum LinkedList{
Tail,
Head(T,Box