The Viterbi algorithm solves the decoding problem for Hidden Markov Models in O(T·S²) time using dynamic programming, where T is sequence length and S is the number of states. At each step, it computes the most likely path to each state: δ_t(s) = max_{s'} [δ_{t-1}(s') · A(s'→s)] · B(s,o_t), where A is the transition matrix and B is the emission matrix. The traceback recovers the optimal state sequence. Originally devised for convolutional codes in digital communications (1967), it now underpins speech recognition (HMM acoustic models), gene finding, and protein structure prediction.