Removing duplicates from unsorted linked lists