The document discusses algorithms for optimal sequence alignment using dynamic programming. It describes the Needleman-Wunsch algorithm for global alignment and the Smith-Waterman algorithm for local alignment. Both algorithms use dynamic programming to find the highest scoring alignment between two sequences by dividing the problem into independent subproblems. The Needleman-Wunsch algorithm allows gaps across the entire length of the sequences, while Smith-Waterman only considers local regions with high similarity.