Change algorithm Viterbi