The authors consider the problem of reconstruction of hidden state sequences for mixture distributions with constituents described by the generalization of high-order Markov chains and hidden Markov models. A new algorithm to solve the problem using dynamic programming is proposed, as well as its modifications to eliminate recursion and reduce search. The results are applied to the problem of gene fragment recognition in plants.