This is an old revision of the document!
Continuing with our single-linked list, this week we are expanding our library with 5 new functions, for list processing.
After you make upgrade-sll1
, you will find five new .c files in the /sll1/src/list/
directory:
It is recommended to work on them in that order.
However, unlike sll0, unit tests for these functions do not rely on each other so the order in which you complete them are up to you. This is just the recommended path.
Each file contains its corresponding functions.
*Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, regarding the functionality of this project.
*For anybody interested in editing the wiki page, here is the dokuwiki user guide: https://www.dokuwiki.org/wiki:syntax#basic_text_formatting -Ash
We will be creating more functions for our lists, similar to what we've done for the previous two projects. The functions are as follows:
displayb(): displays the contents of a list backwards.
append(): Adds a node into a list after the specified place. For example, if our list is (4)→(6)→(8)→NULL, and we append 7 into (6), then our list will be (4)→(6)→(7)→(8)→NULL.
compare(): Will read two given lists. At the first node of difference the function will output a < or > sign depending on which node held a higher value.
cp(): Will create a copy of a list
search(): Will be given a value and a list, after which the function will search through the list until it finds the first node containing the given value. The function will then return a pointer to the node of matching value.
Unit Tests will consist of 58 different tests as to which you are provided to check the functionality of your code. For more specific outputs, you can check the unit tests inside /unit/list/. Remember that the code for these are provided to you and free for you to modify. If you need to add stuff to these unit tests to help you debug your code feel free, just make sure to comment what you added and remove it later once you are done. Including examples of successful runs of these tests would make this page very large, so if you would like examples of successful tests feel free to ask on discord.