add Viterbi algorithm