Check in the algorithm to reverse a linked list