Pseudo code for Value Iteration and Policy Iteration (two different versions from the supplementary course textbooks) are copied here: