Dynamic programming algorithms for computing the minimal cost of aligning gene sequences and for extracting optimal alignments.