Pseudo code for algorithm.