Efficient Markovian algorithms for haplotype reconstruction