primitive Viterbi implementation
started primitive viterbi