Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Strategic Database Technology Management For The Year 2000

Authors: Alan Simon

1st Edition

155860264X, 978-1558602649

More Books

Students also viewed these Databases questions