Needleman-Wunsch (1970) uses dynamic programming for global sequence alignment. Score matrix: F(i,j) = max{ F(i−1,j−1)+s(xi,yj), F(i−1,j)+gap, F(i,j−1)+gap }. Optimal score is F(m,n) (bottom-right). Traceback recovers the alignment. Time complexity O(mn), space O(mn). Smith-Waterman adapts this for local alignment (used in BLAST with heuristics). Substitution matrices (BLOSUM62, PAM) encode evolutionary rates.