linkedlist cycle reimpl