CSCA48H: Exercise 4

The exercise is about linked lists, including one circularly linked list function.

You may find this exercise challenging. If this is the case, please draw lots of examples of linked lists like we did in lecture. Much of the hard work will be thinking of all the special cases (empty lists, length one lists, duplicate values in various arrangements, and so on).

We provide starter code: e4.py. This starter code has a function to_string that returns a string containing the values in the linked list parameter. Read the code in the main block for examples of how to use it and what to expect.

There are 3 functions you need to write, and you will find their headers and docstrings in the starter code.

Be careful about pep8. Because all three parts are in the same file, a single mistake can mean a 0. Please check every time before you submit.

A circular linked list is a linked list in which the last node or tail of the list points to the first node or front (or head) of the list.