User Tools

Site Tools


notes:data:fall2022:projects:dll0

BACKGROUND

SPECIFICATIONS

Six functions to make this week:

mklist()
cplist()
append()
display()
insert()
find()

These functions are similar to the ones we made for the singly linked list, in fact, almost identical. The only difference is we haven't made a find() function yet. Only a search() function. Find will either start from lead or a node specified by what is passed in. Other than that, the only difference between the other four functions and the doubly linked version is you have to care for both sides of the nodes. Mainly, changing the left pointer to the node before, if there is one.

*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

PROGRAM

NOTE: mklist() also has a status code of DLL_INVALID, this is not listed inside the mk.c file.

NOTE: If you are finding it difficult to read all of your different check cases (for list null, empty etc.), you can make use of flags that way you can do all of the checks at the top. This might help of you are experiencing incorrect error outputs.

NOTE: For find() please be aware that the foundNode node when not NULL, is in fact where the search should start. For example, if you have a tmp = NULL & then a find(list, 2, tmp) the following will search everything after the 2 that was found: find(list, 2, tmp since tmp is now equal to where the previous 2 was found.

1. Mklist()
2. Append()
3. Insert()
4. Display()
5. Find()
6. Copylist()

DEBUGGING

Useful tools for debugging issues are gdb and examining the test files themselves. to utilize gdb, run the test program with the gdb command (not make check), with a command that might look like “gdb ./bin/unit-lobtain”. Once in gdb the “run” command with start the program, and “break (line number)” will cause the program to stop at the specified line number. Once you have hit the breakpoint you can use “display (variable name)” to see the value of a variable at every step, “n” to step to the next line, and “continue” to continue running the program until the next breakpoint. Note that if you encounter a seg fault the program will tell the where the seg fault occurs, and you can use “run” again to restart the program.

OUTPUT SPECIFICATIONS

No output to stdout other than from display() will come from any of the functions. Functions should return status codes specified inside the function commented above your code. These will already be included and listed for you.

UNIT TESTS

Similar to every other week, make clean, make, and make check are essential tosee how your functions are doing. It will be very helpful to check the errors file that's created after running make in order to see what errors you are getting (Recommended to start with the first error). 142 total tests spread amongst all the functions. Mk has 12 tests, cp with 18, append and insert with 36 each, display with 12, and finally find with 28. Test output is split amongst list display, reverse list display, and status codes.

notes/data/fall2022/projects/dll0.txt · Last modified: 2022/10/28 03:56 by dmuck