Explanation:
Remember, an algorithm in simple words means a set of instructions or steps to be followed in other to solve a problem.
Note, to decide which commute is cheaper, it means the output of the algorithm should be the cheaper way to commute.
Using pseudocode do the following;