2.1 Algorithm diagram

The following is the flow chart.