The goal of this assignment is to reinforce linked lists in C++.
The archive list_methods.zip is not a project but provides the files to start a project. Your job is to supply the implementations of the functions in list.h by creating a file list.cpp and including the implementations in that file.
If you are successful, the output from try_list_methods.cpp will look like the following output sample.
The linked list toolkit with node is included in the files provided. Also, there is a package of utility functions used in try_list_methods.cpp.
There are some important points you should observe in your work:
The list parameters are const, so your implementations should not attempt to change the parameters.
The first few functions, tail, head, list_is_empty and cons, will be implemented working directly with nodes or using the toolbox as you see fit.
The remaining functions, from the two append methods onward, should be implemented just using the first four functions. You may also use NULL when an empty list is needed.
Algorithms are provided below (equals method) for these latter functions. While you dont have to use them, they are about as straightforward as possible.
As an illustration of how to interpret the algorithms, here is the method equals which compares two lists for equality. See the code below for the function header and the implementation. We could describe the algorithm used as follows:
If list1 is empty then return true if list2 is also empty, return false if list2 is not empty.
Otherwise, if list2 is empty, return false (because list1 is not)
Otherwise, if the head of list1 is not equal to the head of list2 then return false
Otherwise, compare the tail of list1 with the tail of list2 for equality and return the result.
It is not our intention to break the school's academic policy. Projects posted are only used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly fill out the form.
Please provide a valid email address and we'll get back to you in less than 24 hours.
We will be sending an invoice through PayPal upon confirmation.
We are a non profit organization however we need an amount to keep this organization running,
and to be able to complete our research and development.