how to determine if a linked list is cyclic