haas/fall2026/data/projects/sll0.md
... ...
@@ -0,0 +1,132 @@
1
+# PROJECT: SINGLY LINKED LISTS (sll0)
2
+
3
+## OBJECTIVE
4
+
5
+Undertaking our first data structure implementation for the semester.
6
+
7
+## TASK
8
+
9
+By the deadline, please do the following:
10
+
11
+ * implement your own singly-linked list implementation, in C:
12
+ * `Node` struct, containing a value integer and a next Node pointer
13
+ * `Node *mknode (int);`
14
+ * `Node *insert (Node *, Node *, Node *);`
15
+ * `Node *append (Node *, Node *, Node *);`
16
+ * `Node *obtain (Node **, Node *);`
17
+ * `Node *rmnode (Node *);`
18
+ * test your linked-list implementation
19
+
20
+### NODE STRUCT
21
+
22
+The core of the linked list is the `Node`, the unit that is transacted
23
+within the data structure.
24
+
25
+For our current minimal purposes, your node should contain at least two
26
+items:
27
+
28
+ * `value`, an integer
29
+ * `next`, a pointer to a Node
30
+
31
+### MKNODE()
32
+
33
+To facilitate the creation of nodes, write an `mknode()` function that
34
+manages the memory allocation, checking of successful allocation, and
35
+assignment of payload (`value`), and initializing `next` to `NULL`.
36
+
37
+Memory is allocated with `malloc(3)`. Be sure to properly case its return
38
+value to your node pointer type.
39
+
40
+On error, `mknode()` should return `NULL`.
41
+
42
+### INSERT()
43
+
44
+There are two ways to add nodes into a list. The `insert()` function will
45
+add a node *before* an indicated node in the list.
46
+
47
+The parameters are as follows:
48
+
49
+ * pointer to the start of the list
50
+ * pointer to the node in the list you'd like to insert before
51
+ * pointer to the node you'd like to insert into the list
52
+
53
+A pointer to the start of the list is returned.
54
+
55
+You should check to make sure the involved things are not NULL (as a
56
+segmentation fault would occur otherwise).
57
+
58
+Make use of the minimal number of needed temporary pointers. Remember not
59
+to micro-manage.
60
+
61
+You will need to manage cases of null and empty lists.
62
+
63
+Make sure to keep the start of list pointer updated.
64
+
65
+### APPEND()
66
+
67
+There are two ways to add nodes into a list. The `append()` function will
68
+add a node *after* an indicated node in the list.
69
+
70
+The parameters are as follows:
71
+
72
+ * pointer to the start of the list
73
+ * pointer to the node in the list you'd like to append after
74
+ * pointer to the node you'd like to insert into the list
75
+
76
+A pointer to the start of the list is returned.
77
+
78
+You should check to make sure the involved things are not NULL (as a
79
+segmentation fault would occur otherwise).
80
+
81
+Make use of the minimal number of needed temporary pointers. Remember not
82
+to micro-manage.
83
+
84
+You will need to manage cases of null and empty lists.
85
+
86
+Make sure to keep the start of list pointer updated.
87
+
88
+### OBTAIN()
89
+
90
+To get a node out of the list, we `obtain()` it. This function will
91
+isolate a node in a list, maintaining continuity of the remaining list.
92
+
93
+The parameters are as follows:
94
+
95
+ * double pointer to the start of the list
96
+ * single pointer to the node you'd like to obtain
97
+
98
+A pointer to the now-isolated node is returned.
99
+
100
+You should make sure to check for any NULL values before dereferencing
101
+pointers (to avoid segmentation faults).
102
+
103
+Make use of the minimal number of needed temporary pointers. Remember not
104
+to micro-manage.
105
+
106
+You will need to manage cases of null and empty lists.
107
+
108
+Make sure to keep the start of list pointer updated.
109
+
110
+### RMNODE()
111
+
112
+To deallocate a standalone node, you pass it to `rmnode()`. This function
113
+will mark the allocated memory for deallocation (with `free(3)`), and set
114
+the pointer to NULL, returning that pointer.
115
+
116
+Be sure to check things for NULL (you don't want to `free()` a NULL)
117
+
118
+## SUBMISSION
119
+
120
+```
121
+52:sll0:final tally of results (26/26)
122
+*:sll0:implement node struct and mknode, rmnode functions [13/13]
123
+*:sll0:implement and test insert function [13/13]
124
+*:sll0:implement and test append function [13/13]
125
+*:sll0:implement and test obtain function [13/13]
126
+```
127
+
128
+Additionally:
129
+ * Solutions not abiding by spirit of project will be subject to a 25% overall deduction
130
+ * Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
131
+ * Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction
132
+ * 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