3.5.2 Algorithm diagram

The following is the flow chart.