Use global sequence alignment, for example the Needleman-Wunsch algorithm with an appropriate substitution matrix and gap penalty. The two full-length globin proteins are related by orthology and are from closely related species, so the expected correspondence extends across both complete sequences. Unmatched ends should normally contribute to the score rather than being discarded.
With a linear gap penalty of magnitude , the dynamic programming entry is the best score for the first and residues. It satisfieswith , , and traceback from . An affine gap penalty uses separate match and gap states.