Next: Priority Queue
Up: Assignment 4: Exam Recovery
Previous: Recursion
- 1.
- Load up your List class from a couple of assignments ago
or get mine from my web page.
- 2.
- Add a method to the List class called noLoops that
checks whether the List contains a loop. Note that the loop
does not necessarily go back to the first element, so you have
to make sure that you never see any nodes more than once.
- 3.
- Convince yourself that your method will terminate even
if the List contains a loop, and test it with a couple of Lists
that do and do not contain loops.
- 4.
- Turn in a copy of this method only (along with any helper
methods you created).
Allen B. Downey
1998-10-07