Z-Algorithm

Z-Algorithm is a an efficient string pre-processing algorithm capable of solving many string problems with a more efficient time complexity. It is more easier to understand than some of the complex string pre-processing algorithms. It relies on building a Z -array in linear time complexity which can then be leveraged to solve some of the common string problems, most common being the pattern matching or pattern finding.