detect linkedlist cycle