Truncation algorithms for Markov chains and processes