pseudocode for reversing a linked list