Question: This assignment, you will be working with structs using their impl blocks just like the last assignment. Since we are implementing a data structure, we

 This assignment, you will be working with structs using their implblocks just like the last assignment. Since we are implementing a datastructure, we must make sure that this structure can store different data

This assignment, you will be working with structs using their impl blocks just like the last assignment. Since we are implementing a data structure, we must make sure that this structure can store different data types. To do this, we will be implementing our functions using Generic types. For example: struct Point { x: T, y: T, \} You can read more about Generics in the Rust Docs. You will also be working with memory pointers to keep track of the front of the List. This is done by creating a Box : : new with a Link: : new inside of it. Using a memory pointer allows for us to store the front of the list in a struct variable. We can then use this pointer to find its next pointer in the List and so on. You can read more about Boxes in the Rust Docs. - Complete the function. It should return a new LinkedList with an optional pointer to the front of the List set to None and a length of 0 . - Complete the function. This function returns the length of the List. - Complete the function. This function returns true if the List is empty and false otherwise. - Complete the LinkedList: :add_front (\&mut self, thing: T) function. This function is used to add a new thing to the front of the List. - Complete the LinkedList: : add_back(\&mut self, thing: T) function. This function is used to add a new thing to the back of the List. - Complete the function. It should return a new Link storing the thing passed in and an optional pointer to the next thing in the List set to None

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!