The Knuth-Morris-Pratt (KMP) algorithm is a pattern matching algorithm used to search for a pattern within a text. It was introduced in 1974 by Donald Knuth, Vaughan Pratt, and James H. Morris, and jointly published by all three in 1977. The KMP algorithm works by comparing each character in the pattern to characters in the text. If a mismatch is found, the pattern is shifted according to a prefix table, which specifies how many positions to shift the pattern. The prefix table is derived from the length of substrings in the pattern.