>Lecture 6 - Circular Lists
Make your own free website on Tripod.com

3. Circular Lists

A circular list is one in which the last node is followed by the first node:

Circular lists are usually preferable to non-circular ones, for two reasons: At the implementation level, however, circularity does create one very tricky case that is a very common source of bugs, and that is singleton lists. When there is only one node in a circular list, it points to itself as the next node. You have to think carefully to handle this correctly.