Detecting Loop in Linkedlist