C++作业代写/C代写/数据结构代写/算法代写: Finishing a Linked List

Finishing a Linked List

C++作业代写/C代写/数据结构代写/算法代写:这是一个通过C++实现链表的基础数据结构操作的程序代写
Summary
In this assignment, you will finish the testing and implementation of the linked list class that we started in class.
Learning Goals
To practice writing test cases, debugging, and manipulating linked data structures.
Collaboration
For this assignment, you will submit individual work, but discussion with peers is strongly encouraged.
Submission
Turnin Form
Assignment
Refer back to the linked list class header and implementation we started in class, and some initial test cases. You can also download the Makefile that implements the “make test” target, and will attempt to compile a main.cpp file with “make” if provided.

(20%) First, add to the existing test cases additional tests for handling boundary and corner/edge cases of the push_front(), pop_front(), front(), empty(), and remove(). You can test your tests against the standard library by changing the namespace used to search for the forward_list class (see the comments at the top of the test file) then compiling and executing your test file normally. When you are satisfied that a new test is valid, change the used namespace back to CS270 test and debug your own linked list class.

(20%) Second, you may have noticed that we neglected to write a destructor! You can verify with valgrind that many of the tests will be leaking memory currently – write a destructor to fix that, and fix any other memory leaks you find.

(30%) Third, write test cases for the function merge(). The description of the function is here. You only need to implement the one-argument version that takes a reference to another forward_list. In short, your merge function should take two lists, each of which is already sorted, and combine them such that all the elements from the second list are moved into the first list, such that the resulting final list is still in sorted order. Again, remember that you can change the “using namespace” line in the tester to test your test cases against the standard library. Make sure that you test the effects of the function on both lists!

(30%) Finally, write the merge() function implementation in your own linked list class, and verify that is passes your test cases.

Submitting your work
Make sure your files are named correctly as specified above. In your comments at the top, make sure you:

acknowledge any help or outside sources, in accordance with the academic honesty policy;
describe any known bugs in the program.
Submit your completed files using the online turnin form. Be sure to select Homework 4.

发表评论

电子邮件地址不会被公开。 必填项已用*标注