get pointer to the node which will be the last node of the final list last_node
if ( head1 . prev . data < head2 . prev . data ) : NEW_LINE INDENT last_node = head2 . prev NEW_LINE DEDENT else : NEW_LINE INDENT last_node = head1 . prev NEW_LINE DEDENT