PROJECT: SINGLY LINKED LISTS (sll1)
OBJECTIVE
Modifying our singly-linked list with a list management layer.
TASK
By the deadline, please do the following:
- create a
Liststruct, containing a head and tail node pointers - create the following List functions:
List *mklist ();List *clearlist (List *);List *rmlist (List *);
- adapt your own singly-linked list implementation, in C:
List *insert (List *, Node *, Node *);List *append (List *, Node *, Node *);List *obtain (List **, Node *);Node *rmnode (List *);
- test your linked-list implementation
LIST STRUCT
The List struct will serve as a management layer for our list, giving
us a reliable container with known points of access to the beginning and
end of any list we make.
For our current minimal purposes, your list should contain at least two items:
-
head(or start of list referencing value), a Node pointer -
tail(or end of list referencing value), a Node pointer
MKLIST()
Like mknode() except it focuses on creating a new List instance.
Allocate memory and do any error checking, ensuring pointers are set to
NULL.
On error, mklist() should return NULL.
CLEARLIST()
The purpose of clear list is to automate the effective and reliable emptying of a given list: clear and deallocate any populated nodes (utilizing other existing functions to assist).
An empty list is returned, or NULL on some sort of error state.
RMLIST()
The purpose of rmlist is to empty and deallocate a given list, returning a NULL value at the end.
You can pass a populated list to rmlist(): it is rmlist's job to call
other routines to clear out the list before proceeding with deallocating
the list pointer in question.
INSERT()
Adapt insert() to transact using List pointers.
APPEND()
Adapt append() to transact using List pointers.
OBTAIN()
Adapt obtain() to transact using List pointers.
SUBMISSION
104:sll1:final tally of results (104/104)
*:sll1:implement list struct [13/13]
*:sll1:implement and test mklist function [13/13]
*:sll1:implement and test clearlist function [13/13]
*:sll1:implement and test rmlist function [13/13]
*:sll1:adapt and test insert function [13/13]
*:sll1:adapt and test append function [13/13]
*:sll1:adapt and test obtain function [13/13]
*:sll1:code is well commented, organized, functional [13/13]
Additionally:
- Solutions not abiding by spirit of project will be subject to a 25% overall deduction
- Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction
- Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction
- 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