Reverse a single-linked list