Corning Community College
CSCS2320 Data Structures
To continue to enhance our ability to explore various algorithmic and computing realms through the exploration and cultivation of debugging and troubleshooting skills, and collaboratively authoring and documenting the project and its specifications.
To assist with consistency across all implementations, project files for use with this project, along with the integration of the work you did on the last project, is made possible via a special recipe in the Makefile.
Simply go into the project base directory, and run:
lab46:~/src/SEMESTER/DESIG/prevPROJECT$ make upgrade-sll1
You will want to go here to edit and fill in the various sections 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.
Another thing to note is that the sll1 project files can only compile with version 9 of gcc. If you are not on lab46 and the project fails to build the library or unit tests, this may be because you are using a newer or older version of gcc.
You can use the same version of gcc as lab46 by using the following commands (assuming you are using a Raspberry Pi with it's default OS) in this link: https://gist.github.com/sol-prog/95e4e7e3674ac819179acf33172de8a9
*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. Note that append() will not be a simple modification of the insert() function from sll0, it must handle special cases where the user wants to insert a node on a NULL position.
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.
Besides displayb(), nothing will be displayed from these functions individually. However, the return values and what they do to the list are specified above in the program section.
Compare will return a value, uc, specified within the included header files. The return value should be equal to the total amount of differences in the lists. The pos value, if not null, should be the position of the first difference in the two lists. For example, if you have two lists with a difference at position 3, 7, and 14, the function should return the value of all of the COMP_L(1 or 2 goes here)_(GREATER or LESS) combined. If pos is null, it should not change from null.
DEBUG: If you run into an issue that requires in-depth debugging, consider using gdb. To run gdb type gdb bin/(file to debug), then type run. If you need to do further debugging you can make use of list (lists lines) and break # for the line you want to set a breakpoint on. You can use display to show the values of variables, and you can make use of N (next), S(step), and C(continue-resume the execution to breakpoint).
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.
Also note that some unit tests for sll1 make use of certain functions made in previous projects. So if some of the functions from sll0 aren’t up to par, it’s likely to cause problems trying to pass the unit tests for sll1.
Some might find their unit-compare test is failing for test #8, where pos is checked, but not for test #13 and test #14, where pos is also checked. This is likely due to only changing pos when CMP_EQUALITY is not the case. As a solution, consider always changing pos to reflect the position being checked even if both lists are equal.
To be successful in this project, the following criteria (or their equivalent) must be met:
Let's say you have completed work on the project, and are ready to submit, you would do the following (assuming you have a program called uom0.c):
lab46:~/src/SEMESTER/DESIG/PROJECT$ make submit
You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.
I'll be evaluating the project based on the following criteria:
78:sll1:final tally of results (78/78) *:sll1:obtained project by the Sunday prior to duedate [13/13] *:sll1:clean compile, no compiler messages [13/13] *:sll1:implementation passes unit tests [13/13] *:sll1:adequate modifications to code from template [13/13] *:sll1:program operations conform to project specifications [13/13] *:sll1:code tracked in lab46 semester repo [13/13]