User Tools

Site Tools


notes:data:fall2022:projects:sll1

This is an old revision of the document!


BACKGROUND

Continuing with our single-linked list, this week we are expanding our library with 5 new functions, for list processing.

SPECIFICATIONS

After you make upgrade-sll1, you will find five new .c files in the /sll1/src/list/ directory:

  • append.c (use insert for reference)
  • cp.c (will have to make use of mklist)
  • displayb.c (display but backwards)
  • search.c (similar logic to getpos())
  • compare.c (use strcmp() for reference)

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

PROGRAM

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.

OUTPUT SPECIFICATIONS

UNIT TESTS

notes/data/fall2022/projects/sll1.1663969294.txt.gz · Last modified: 2022/09/23 21:41 by hcordell