Remember that circularly linked lists need some way of telling the for loop that we have come full circle. Most of the time I usually use the value of the list->head pointer to know that I have traversed the whole list. If this does not work it is possible to implement a visited flag like one would implement in a graph traversal algorithm. The latter method does take more time in managing the flags though.
Kressilac
More Linked Lists!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement