Continued fractions and Berlekamp-Massey algorithms