Implements the Viterbi decoding algorithm to find the most likely state sequence for a given observation sequence