adding algorithm for finding cycles in linked list