Markov Chains: Theory and Applications