Corning Community College
CSCS2320 Data Structures
~~TOC~~
This section will document any updates applied to the project since original release:
In this project, we continue our doubly linked list re-write, completing the remaining library functions.
As this project utilizes the code you wrote in dll0, you must upgrade to dll1 from dll0 (same thing that we did to transition between the sll* projects):
lab46:~/src/data/dll0$ make upgrade-dll1 ...
As we started with the last project, we're implementing the remaining functions of our new doubly linked list implementation.
As such, new function prototypes have been added to the list.h header file:
code_t rmlist (List **); // deallocate empty list code_t obtain (List **, Node **); // disconnect node from list code_t compare(List *, List *, ulli *); // compare two lists code_t empty (List **); // empty an existing list code_t sort (List **, int); // sort list by mode code_t swap (List **, Node *, Node *); // swap nodes in list
These functions will also make use of the status/error codes introduced in dll0. Additional effort has gone into identifying likely codes applied in various conditions. Be sure to reference the provided comments as well as the unit tests for more information.
You'll notice the presence of a set of #define's in the list header file. These are intended to be used to report on various states of list status after performing various operations.
They are not exclusive- in some cases, multiple states can be applied. The intent is that you will OR together all pertinent states and return that from the function.
For example, in the case of “DLL_MALLOC_FAIL”, there are actually a total of three states raised:
ALL THREE states must be returned from the function in question should such an occurrence take place.
In src/list/, you will find the addition of a new set of skeletons of the above prototyped functions, hollowed out in anticipation of being made operational.
Figure out what is going on, the connections, and make sure you understand it.
Be sure to focus on implementing the functionality from scratch (the more you do this from scratch, vs. referencing old code, the more it will help you).
In testing/list/unit/, you will find these new files:
Enhancements to these unit tests may be provided via dll1 project updates.
There are also corresponding verify-FUNCTION.sh scripts that will output a “MATCH”/“MISMATCH” to confirm overall conformance with the pertinent list functionality.
These are complete runnable programs (when compiled, and linked against the list library, which is all handled for you by the Makefile system in place).
Of particular importance, I want you to take a close look at:
To assist you in verifying a correct implementation, a fully working implementation of the node and list libraries should resemble the following (when running the respective verify script):
Here is what you should get for list:
lab46:~/src/data/dll1$ bin/verify-list.sh ==================================================== = Verifying Doubly-Linked List Functionality = ==================================================== [mklist] Total: 11, Matches: 11, Mismatches: 0 [cplist] Total: 17, Matches: 17, Mismatches: 0 [append] Total: 22, Matches: 22, Mismatches: 0 [insert] Total: 22, Matches: 22, Mismatches: 0 [display] Total: 12, Matches: 12, Mismatches: 0 [find] Total: 28, Matches: 28, Mismatches: 0 [compare] Total: 18, Matches: 18, Mismatches: 0 [empty] Total: 6, Matches: 6, Mismatches: 0 [rmlist] Total: 6, Matches: 6, Mismatches: 0 [obtain] Total: 57, Matches: 57, Mismatches: 0 [swap] Total: 9, Matches: 9, Mismatches: 0 [sort] Total: 42, Matches: 42, Mismatches: 0 ==================================================== [RESULTS] Total: 250, Matches: 250, Mismatches: 0 ==================================================== lab46:~/src/data/dll1$
To be successful in this project, the following criteria must be met: