Comparison of local- and global-alignment algorithm strategies. Top: Global alignments are generated when two DNA sequences (A and B) are compared and an optimal similarity score is determined over the entire length of the two sequences. Bottom: Local alignments are produced when two DNA sequences (A and B) are compared and optimal similarity scores are determined over numerous subregions along the length of the two sequences. The local-alignment algorithm works by first finding very short common segments between the input sequences (A and B), and then expanding out the matching regions as far as possible.