Comparison of global and local alignment. Global alignment optimizes the alignment over the full length of the sequences A and B. Local alignment locates the best alignment between sub-regions of A and B. There may be a large number of distinct local alignments.