750e854782a1f05d19fc128c99dd7c7da5c1f136
haas/fall2026/data/projects/sll1.md
| ... | ... | @@ -0,0 +1,90 @@ |
| 1 | +# PROJECT: SINGLY LINKED LISTS (sll1) |
|
| 2 | + |
|
| 3 | +## OBJECTIVE |
|
| 4 | + |
|
| 5 | +Modifying our singly-linked list with a list management layer. |
|
| 6 | + |
|
| 7 | +## TASK |
|
| 8 | + |
|
| 9 | +By the deadline, please do the following: |
|
| 10 | + |
|
| 11 | + * create a `List` struct, containing a head and tail node pointers |
|
| 12 | + * create the following List functions: |
|
| 13 | + * `List *mklist ();` |
|
| 14 | + * `List *clearlist (List *);` |
|
| 15 | + * `List *rmlist (List *);` |
|
| 16 | + * adapt your own singly-linked list implementation, in C: |
|
| 17 | + * `List *insert (List *, Node *, Node *);` |
|
| 18 | + * `List *append (List *, Node *, Node *);` |
|
| 19 | + * `List *obtain (List **, Node *);` |
|
| 20 | + * `Node *rmnode (List *);` |
|
| 21 | + * test your linked-list implementation |
|
| 22 | + |
|
| 23 | +### LIST STRUCT |
|
| 24 | + |
|
| 25 | +The `List` struct will serve as a management layer for our list, giving |
|
| 26 | +us a reliable container with known points of access to the beginning and |
|
| 27 | +end of any list we make. |
|
| 28 | + |
|
| 29 | +For our current minimal purposes, your list should contain at least two |
|
| 30 | +items: |
|
| 31 | + |
|
| 32 | + * `head` (or start of list referencing value), a Node pointer |
|
| 33 | + * `tail` (or end of list referencing value), a Node pointer |
|
| 34 | + |
|
| 35 | +### MKLIST() |
|
| 36 | + |
|
| 37 | +Like `mknode()` except it focuses on creating a new List instance. |
|
| 38 | +Allocate memory and do any error checking, ensuring pointers are set to |
|
| 39 | +NULL. |
|
| 40 | + |
|
| 41 | +On error, `mklist()` should return `NULL`. |
|
| 42 | + |
|
| 43 | +### CLEARLIST() |
|
| 44 | + |
|
| 45 | +The purpose of clear list is to automate the effective and reliable |
|
| 46 | +emptying of a given list: clear and deallocate any populated nodes |
|
| 47 | +(utilizing other existing functions to assist). |
|
| 48 | + |
|
| 49 | +An empty list is returned, or NULL on some sort of error state. |
|
| 50 | + |
|
| 51 | +### RMLIST() |
|
| 52 | + |
|
| 53 | +The purpose of rmlist is to empty and deallocate a given list, returning |
|
| 54 | +a NULL value at the end. |
|
| 55 | + |
|
| 56 | +You can pass a populated list to `rmlist()`: it is rmlist's job to call |
|
| 57 | +other routines to clear out the list before proceeding with deallocating |
|
| 58 | +the list pointer in question. |
|
| 59 | + |
|
| 60 | +### INSERT() |
|
| 61 | + |
|
| 62 | +Adapt `insert()` to transact using `List` pointers. |
|
| 63 | + |
|
| 64 | +### APPEND() |
|
| 65 | + |
|
| 66 | +Adapt `append()` to transact using `List` pointers. |
|
| 67 | + |
|
| 68 | +### OBTAIN() |
|
| 69 | + |
|
| 70 | +Adapt `obtain()` to transact using `List` pointers. |
|
| 71 | + |
|
| 72 | +## SUBMISSION |
|
| 73 | + |
|
| 74 | +``` |
|
| 75 | +104:sll1:final tally of results (104/104) |
|
| 76 | +*:sll1:implement list struct [13/13] |
|
| 77 | +*:sll1:implement and test mklist function [13/13] |
|
| 78 | +*:sll1:implement and test clearlist function [13/13] |
|
| 79 | +*:sll1:implement and test rmlist function [13/13] |
|
| 80 | +*:sll1:adapt and test insert function [13/13] |
|
| 81 | +*:sll1:adapt and test append function [13/13] |
|
| 82 | +*:sll1:adapt and test obtain function [13/13] |
|
| 83 | +*:sll1:code is well commented, organized, functional [13/13] |
|
| 84 | +``` |
|
| 85 | + |
|
| 86 | +Additionally: |
|
| 87 | + * Solutions not abiding by spirit of project will be subject to a 25% overall deduction |
|
| 88 | + * Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction |
|
| 89 | + * Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction |
|
| 90 | + * Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction |