Berlekamp-Massey algorithm (source code)

= Berlekamp-Massey algorithm
{c}
{wiki=Berlekamp–Massey_algorithm}

The Berlekamp-Massey algorithm finds the shortest linear recurrence satisfied by a finite sequence over a field. It processes symbols incrementally, updating the connection polynomial whenever the current recurrence has a nonzero discrepancy.