Iterate through the head1 to find the last node join the next of last node of head1 to the 1 st node of head2
while ( tail != None ) : NEW_LINE INDENT if ( tail . next == None and head2 != None ) : NEW_LINE INDENT tail . next = head2 NEW_LINE break NEW_LINE DEDENT tail = tail . next NEW_LINE DEDENT