Correctly implementing Viterbi algorithm. Without backpointers so far.