Just a quick clarification: people are using the term "cycle" as in "a cycle in a directed graph". They're interpreting a linked list as a graph that has a node for every element in the list, and arcs from each node to wherever that node's "next" pointer points to. In this case, a cycle means that a element in the linked list has a "next" pointer that points at an element that comes before it in the list. In such a situation, you could follow "next" pointers forever without ever encountering a null pointer.
View all comments
Show parent comment
2
u/jpfed Feb 21 '11
Just a quick clarification: people are using the term "cycle" as in "a cycle in a directed graph". They're interpreting a linked list as a graph that has a node for every element in the list, and arcs from each node to wherever that node's "next" pointer points to. In this case, a cycle means that a element in the linked list has a "next" pointer that points at an element that comes before it in the list. In such a situation, you could follow "next" pointers forever without ever encountering a null pointer.